c++ assert keyword code example
Example 1: 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
Example 2: c++ assert
static_assert(sizeof(long) == 8, "long must be 8 bytes");
static_assert(sizeof(int) == 4, "int must be 4 bytes");
int main()
{
return 0;
}