assert function code example
Example 1: what is assert
In simple words, if the assert condition is true then the
program control will execute the next test step but if the condition is
false, the execution will stop and further test step will not be executed.
Example 2: c++ assert
assert(std::is_same_v); // error: assert does not take two arguments
assert((std::is_same_v)); // OK: one argument
static_assert(std::is_same_v); // OK: not a macro
std::complex c;
assert(c == std::complex{0, 0}); // error
assert((c == std::complex{0, 0})); // OK