天天看點

使用模闆特化定義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>())