#pragma once #include "format.hpp" #include "source_location.hpp" #include #include #include namespace util { template struct panic { [[noreturn]] constexpr panic( std::string_view fmt, Ts &&...args, const source_location &source = source_location::current()) noexcept { const auto str = std::format("Panic in function {} in file {}:{},{}: {}\n", source.function_name(), source.file_name(), source.line(), source.column(), format(fmt, std::forward(args)...)); std::cerr.write(str.c_str(), str.size()); std::abort(); } }; template panic(std::string_view, Ts &&...) -> panic; } // namespace util