static_assert role

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_34351547/article/details/102740483

Compiling check, check condition fails, an error message is output 
format: 
The static_assert ( "Conditions", "error message");

Examples: 
The static_assert (! The sizeof (int) = 4, "the this IS Not 32bit Windows!"); 
Judging whether int length of 4, if not, then 32bit not compiler environment, fail and print an error message.
 

Guess you like

Origin blog.csdn.net/qq_34351547/article/details/102740483