MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / Assert

Function Assert

10.13-assert1/main.cpp:10–20  ·  view source on GitHub ↗

#A Assert function taking condition, message, and source location

Source from the content-addressed store, hash-verified

8// #A Assert function taking condition, message, and source
9// location
10void 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
22int main()
23{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected