1static_assert(true); // if condition is false, then assert go boom this is false and stops the code
1assert(std::is_same_v<int, int>); // error: assert does not take two arguments
2assert((std::is_same_v<int, int>)); // OK: one argument
3static_assert(std::is_same_v<int, int>); // OK: not a macro
4std::complex<double> c;
5assert(c == std::complex<double>{0, 0}); // error
6assert((c == std::complex<double>{0, 0})); // OK
1static_assert(sizeof(long) == 8, "long must be 8 bytes");
2static_assert(sizeof(int) == 4, "int must be 4 bytes");
3
4int main()
5{
6 return 0;
7}
8