#pragma once #include namespace lt { struct FailedAssertion: std::exception { FailedAssertion(const char *file, int line) { log_crt("Assertion failed in: {} (line {})", file, line); } }; template constexpr void ensure(Expression_T &&expression, std::format_string fmt, Args &&...args) { if (!static_cast(expression)) { Logger::log(LogLvl::critical, fmt, std::forward(args)...); throw ::lt::FailedAssertion(__FILE__, __LINE__); } } template constexpr void ensure(Expression_T &&expression, const char *message) { if (!static_cast(expression)) { Logger::log(LogLvl::critical, message); throw ::lt::FailedAssertion(__FILE__, __LINE__); } } } // namespace lt