Add a source_location constructor from std::source_location

This commit is contained in:
Peter Dimov
2022-02-03 07:10:59 +02:00
parent ce2133a17f
commit 25f0bab733
4 changed files with 40 additions and 4 deletions
+12
View File
@@ -14,6 +14,10 @@
#include <string>
#include <cstdio>
#if !defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION)
# include <source_location>
#endif
namespace boost
{
@@ -36,6 +40,14 @@ public:
{
}
#if !defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION)
BOOST_CONSTEXPR source_location( std::source_location const& loc ) BOOST_NOEXCEPT: file_( loc.file_name() ), function_( loc.function_name() ), line_( loc.line() ), column_( loc.column() )
{
}
#endif
BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT
{
return file_;