C++ Language/Preprocessing/CompileTimeAssertions
Appearance
The traditional way to assert the truth of something at compile-time was to use the preprocessor's #error
(within some #if
block).
But some compile-time activity happens after the preprocessor has finished, so modern code uses a static_assert()
compile-time assertion.
Additional information about compile-time assertions (includes interactive examples)