static_assert

C ++ 0x introduced static_assert keyword, used for assertion during compilation, and therefore is called static assertions.

The syntax is simple: static_assert (constant expression, suggesting that the string).

If the first argument constant expression is true (true or non-zero value), then static_assert do nothing, as if it did not exist, or will cause a compilation error, the error location is static_assert statement row, The second parameter is the error prompt string.

Guess you like

Origin blog.csdn.net/weixin_34279246/article/details/90807896