COMPILE_ASSERT
来源:互联网 发布:网络社交软件有哪些 编辑:程序博客网 时间:2024/05/16 10:18
template <bool>
struct CompileAssert {
};
#undef COMPILE_ASSERT
#define COMPILE_ASSERT(expr, msg) /
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
在编译时进行检查,由于struct CompileAssert为空,所以不占字节空间。