c++ type trait 之 检验类型关系(Type Relation)
来源:互联网 发布:java里面微积分怎么用 编辑:程序博客网 时间:2024/06/05 08:34
#include <iostream>using namespace std;int main(){ cout << boolalpha; // is_same<T1,T2> T1和T2类型是否相同(包括const volatile修饰符) cout << is_same<const int&, int>::value << endl; // is_base_of<T,D> T是否是D的基类 cout << is_base_of<char, string>::value << endl; // is_convertible<T,D> T能否装换成D cout << is_convertible<double, int>::value << endl; // is_constructible<T,..Args> 能否用Args...初始化T cout << is_constructible<string, char, double>::value << endl; // is_trivially_constructible<T,...Args> 能用Args...平凡(隐式)初始化T cout << is_trivially_constructible<string, char, double>::value << endl; // is_nothrow_constructible<T,..Args> 能否用Args...初始化T且不抛出异常 cout << is_nothrow_constructible<string, char, double>::value << endl; // is_assignable<T,D> 类型T能否被类型D赋值 cout << is_assignable<double, int>::value << endl; // is_trivially_assignable<T,D> 类型T能被类型D平凡赋值 cout << is_trivially_assignable<double, int>::value << endl; // is_nothrow_assignable<T,D> 类型T能被类型D赋值且不抛出异常 cout << is_nothrow_assignable<double,int>::value; //uses_allocator<T,Alloc> Alloc可被转换T::allocator_type system("pause"); return 0;}
阅读全文
0 0
- c++ type trait 之 检验类型关系(Type Relation)
- c++ type trait 之 类型判断工具
- c++ type trait 之 class trait
- c++ type trait 之 useful trait
- c++ type trait 之 类型修饰符(Type Modifier)改动类型
- type trait用于平行类层次中的参数类型检查
- C++--类型转换(Type Casting)
- Type “”类型“”
- bus driver device data type relation
- 九、 通用工具 ----Type Trait 和 Type Utility
- 数据库类型与JDBC TYPE 和Java类型对应关系
- 数据库类型与JDBC TYPE 和Java类型对应关系
- C++—类型转换(Type Casting)
- C主函数main与类型type
- .NET 数据类型之指针类型(type*)
- .NET 数据类型之指针类型(type*)
- jquery源码之属性判断-$.type类型
- Scala入门之高级类型:this.type
- js开发:正则控制输入银行卡
- printf函数的实现
- 为什么TCP传输单元叫作TCP报文段,而UDP的叫作UDP数据报
- NOIP 2007 普及组 复赛 escape 守望者的逃离
- POJ3104-Drying
- c++ type trait 之 检验类型关系(Type Relation)
- 十四、H.264的变换编码(一)——矩阵运算与正交变换基本概念
- 详解 awk 工具的使用方法(转载)
- Java集合(二)
- UE4 C++计时器,创建对象,组件
- Java设计模式之责任链模式
- 第三本书 squid
- yum安装时提示有另一个程序在使用的解决办法
- 解读Uber车祸:人类司机撞上自动驾驶 谁该辩护?