#pragma once #include #include #include namespace lt { template struct ensure { ensure( Expression_T expression, std::format_string fmt, Args_T &&...args, const std::source_location &location = std::source_location::current() ) { if (!static_cast(expression)) { throw std::runtime_error { std::format( "exception: {}\nlocation: {}:{}", std::format(fmt, std::forward(args)...), location.file_name(), location.line() ) }; } } }; template ensure(Expression_T, std::format_string, Args_T &&...) -> ensure; } // namespace lt