#A Assert function taking condition, message, and source location
| 8 | // #A Assert function taking condition, message, and source |
| 9 | // location |
| 10 | void Assert(bool condition, |
| 11 | std::string_view msg, |
| 12 | std::source_location location = |
| 13 | // #B current() is special |
| 14 | std::source_location::current()) |
| 15 | { |
| 16 | if(not condition) { |
| 17 | std::clog << location.function_name() << ':' |
| 18 | << location.line() << ": " << msg << '\n'; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | int main() |
| 23 | { |