5#include <source_location>
33 requires std::constructible_from<std::string_view, T>
35 StringViewSourceLoc(
const T &msg,
const std::source_location loc = std::source_location::current()) noexcept
55 const auto msg = fmt::format(
"{}:{} panic: {}\n", s.
loc_.file_name(), s.
loc_.line(), s.
msg_);
56 std::fputs(msg.c_str(), stderr);
73 const auto msg = fmt::format(
"{}:{} panic: {}\n", s.
loc_.file_name(), s.
loc_.line(), s.
msg_);
74 std::fputs(msg.c_str(), stderr);
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.
void assert_or_panic(const bool condition, const StringViewSourceLoc &s)
Conditionally panics if the given condition is false.
A wrapper for std::string_view with a taggable std::source_location.
StringViewSourceLoc(const T &msg, const std::source_location loc=std::source_location::current()) noexcept
Constructs a StringViewSourceLoc with a message and optional source location.
std::source_location loc_