使用模板特化定义C++编译期警告
2010-12-23 17:14
429 查看
使用模板特化定义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>())
//-- static compile-time assertion
namespace static_assert
{
template<bool> struct FAILD;
template<> struct FAILD<true> { };
}
#define nASSERT_STATIC(exp) (static_assert::FAILD<(exp) != 0>())
相关文章推荐
- [C/C++]在头文件中使用static定义变量意味着什么
- C/C++ 定义向量、赋值和使用
- C++定义构造函数必须使用初始化列表的场合
- C++中使用Socket通信包定义和读取方法
- C++使用之常量的定义
- C++中的命令空间NameSpace定义和使用
- c++使用thread类时编译出错,对‘pthread_create’未定义的引用
- C++ 异常机制分析(C++标准库定义了12种异常,很多大公司的C++编码规范也是明确禁止使用异常的,如google、Qt)
- C++使用模板特化实现工厂模式
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++中“头文件”的定义和使用
- 【C++学习笔记】12_指针的定义与使用
- C/C++:enum-枚举量声明、定义和使用
- C++函数的定义与使用
- C++ 中常见预定义宏的使用
- C++零食:使用Unicode版的预定义宏__FUNCTION__
- C++中,如何定义和使用指向成员函数的指针
- C/C++中结构体的定义和typedef的使用
- C/C++中使用static关键字定义或声明静态对象
- 【C/C++开发】C++之enum枚举量声明、定义、使用与枚举类详解与枚举类前置类型声明