C++ static_assert

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • static_assert( bool_constexpr, message )
  • static_assert( bool_constexpr ) /* Since C++17 */

Parameters

ParameterDetails
bool_constexprExpression to check
messageMessage to print when bool_constexpr is false

Remarks

Unlike runtime assertions, static assertions are checked at compile-time and are also enforced when compiling optimized builds.



Got any C++ Question?