- 模板的闭符之间不需要空格:vector<list<int> > 等同于 vector<list<int>>
- nullptr取代0或者NULL
- 以auto完成类型自动推导
- 一致性初始化与初值列;使用大括号进行初始化动作,如: int values[]{1,2,3} vector<int> v{1,2,3};初值列如:int j{}--j is initialized by 0; int*p{}--q is initialized by nullptr;
- range-based for ; 如 for(auto i: list/range/array/collection)
- move/rvalue reference
- 新式的字符串字面常量。Raw string literal--R"\\\n"; 编码的(Encoded)string literal--u8"lsdkf" u“dd” U"kk" L"hello"
- noexcept--给编译器更大的优化空间。然而,并不是加上noexcept就能提高效率,步子迈大了也容易扯着蛋。防止异常扩散
- constexpr--让表达式核定于编译期
- 崭新的template特性---可以接受个数不定之template实参--variadic template;支持Alias Template/template typedef 通过using;function template可拥有默认的template实参
template<typename T,typename... Types>
void print(const T& first,const Types&... args)
{
cout<<first<<endl;
print(...args);
} - lambda
- decltype--可以让编译器找出表达式类型
- 新的函数声明语法
template<typename T1,typename T2>
decltype(x+y) add(T1 x,T2 y);template<typename T1,typename T2>
auto add(T1 x,T2 y) -> decltype(x+y);