util: make SourceLocation constructor explicit

Follow CppCoreGuidelines C.46:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#rc-explicit
This commit is contained in:
stickies-v
2026-04-17 13:59:18 +01:00
parent 400aa68b4a
commit 8a55b17751

View File

@@ -23,8 +23,9 @@ public:
/// The func argument must be constructed from the C++11 __func__ macro.
/// Ref: https://en.cppreference.com/w/cpp/language/function.html#func
/// Non-static string literals are not supported.
SourceLocation(const char* func,
std::source_location loc = std::source_location::current())
explicit SourceLocation(
const char* func,
std::source_location loc = std::source_location::current())
: m_func{func}, m_loc{loc} {}
std::string_view file_name() const { return m_loc.file_name(); }