所在的位置: c++ >> 基本简介 >> C11新特性

C11新特性

1语法

数组/容器遍历for(autov:container){}

匿名函数(Lambadas)std::functionretType(argTypes…)func=[optVariable](typeargs…){}

静态代码检查static_assert和typetraits

临时对象的右值引用(T)和move语义std::move(T)以及move构造函数T(Ttmp):member(std::move(tmp.member)){}

2类型

类型推断auto

空指针对象nullptr

智能指针unique_ptr(独占内存、计数)/shared_ptr(共享内存、独占计数)/weak_ptr(共享内存、不占计数)/auto_ptr废弃

自定义类型的枚举enumclassEnumType{literal1,literal2,literal3}

3函数

模板函数std::begin()和std::end()

4面向对象

显式覆盖虚函数virtualvoidfunc()override{}

限定函数不再被子类重写voidfunc()final{}









































治疗白癜风医院哪家好
北京白癜风医院



转载请注明:http://www.nydjfy.com/jbjj/1174.html

  • 上一篇文章:
  •   
  • 下一篇文章: