78 using Location = std::source_location;
88 const char* e_str,
const char*, Location l = Location::current()
92 : error(e), error_string(e_str), location(l) {};
95 std::string to_string(
int depth = 0)
const noexcept {
96 std::string_view f = location.file_name();
97 std::string l = std::to_string(location.line());
98 std::string_view fn = location.function_name();
102 3 + depth * 2 + f.size() + l.size() + fn.size() + error_string.size()
104 ret.assign(
" ", depth * 2);
105 ret += f; ret +=
":";
106 ret += l; ret +=
" ";
107 ret += fn; ret +=
" ";
112 const char* what()
const noexcept override {
113 m_string = to_string();
114 return m_string.c_str();
118 const std::string_view error_string;
119 const std::source_location location;
122 mutable std::string m_string;