1.Spaces in Template expressions
vector>; //OK in each C++ version vector
>; //OK since C++11
2.nullptr and std::nullptr_t
C++11中针对空指针,我们用nullptr,之前是使用NULL或者0.
typedef decltype(nullptr) nullptr_t;
3.Automatic Type Deduction with auto
auto i = 42; //i has type int double f(); auto d = f(); //d has type double
当type很长或者很复杂的时候我们用auto
vectorv; vector ::iterator it = v.begin(); auto it = v.begin();
auto s = [](int x)->bool{ //s has the type of lambda ........., };
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)