1. static_assert(常量表达式,"提示字符串")
C++11中引入了static_assert这个关键字,用来做编译期间的断言,因此叫作静态断言。
如果第一个参数常量表达式的值为false,会产生一条编译错误。错误位置就是该static_assert语句所在行,第二个参数就是错误提示字符串。

1. static_assert(常量表达式,"提示字符串")
C++11中引入了static_assert这个关键字,用来做编译期间的断言,因此叫作静态断言。
如果第一个参数常量表达式的值为false,会产生一条编译错误。错误位置就是该static_assert语句所在行,第二个参数就是错误提示字符串。