天天看点

使用模板特化定义C++编译期警告

使用模板特化定义C++编译期警告

//-- static compile-time assertion

namespace static_assert

{

 template<bool> struct FAILD;

 template<> struct FAILD<true> { };

}

#define nASSERT_STATIC(exp) (static_assert::FAILD<(exp) != 0>())