C++11新特性
2016-06-07 20:03
399 查看
1.auto
auto maton=112; //maton is type int
auto pt=&maton //pt is type int*
typedef double (*Fp)(double,int);
Fb fm=0;
auto pf=fm; //pf is type double(*)(double ,int)
2.decltype
double x(0);
int n(0);
decltype (x*n) q=0; //q is same type as x*n,i.e.,double
decltype (&x)pd=&x; //pd same type as &x,double*
int &i=n;
const int& ic=n;
decltype(i) i1=n;
//i1 same type as int&
decltype(ic) i2=n; //i2 same type as const int&
3 using=
typedef std::vector<double>::iterator itTyped1;
using itTyped2=std::vector<double>::iterator;
itTyped1 it1;
itTyped it2;
auto maton=112; //maton is type int
auto pt=&maton //pt is type int*
typedef double (*Fp)(double,int);
Fb fm=0;
auto pf=fm; //pf is type double(*)(double ,int)
2.decltype
double x(0);
int n(0);
decltype (x*n) q=0; //q is same type as x*n,i.e.,double
decltype (&x)pd=&x; //pd same type as &x,double*
int &i=n;
const int& ic=n;
decltype(i) i1=n;
//i1 same type as int&
decltype(ic) i2=n; //i2 same type as const int&
3 using=
typedef std::vector<double>::iterator itTyped1;
using itTyped2=std::vector<double>::iterator;
itTyped1 it1;
itTyped it2;
相关文章推荐
- 飛飛(六十一)模板类实例(各种排序)
- c++ 迭代器库
- Binary Tree Paths
- C语言变长数组data[0]【总结】
- 两个链表是否相交详解
- C库字符输入/输出函数
- Lowest Common Ancestor of a Binary Tree
- Qt/C++ 波形图 心电波 实时显示
- LeetCode 316: Remove Duplicate Letters
- SDUT ACM C语言实验——一元二次方程Ⅱ
- LeetCode 274: H-Index
- 飛飛(六十)交通工具 虚函数的应用
- 图说C++对象模型:对象内存布局详解
- 飛飛(五十九)纯虚函数以及通过两种方式调用
- 飛飛(五十八)虚析构函数
- C++符号的还原(demangling)
- (飛飛五十七)虚函数
- 利用C语言中的函数实现文件的Copy
- C语言 学生宿舍管理系统
- [C++ 面试基础知识总结]字符串,向量和数组