C++语言新特性

来源:互联网 发布:dreamhost java 编辑:程序博客网 时间:2024/06/03 03:44

类型推导

auto c = 0;           // c 是 int 类型

vector 等数组的初始化方法

vector<int> intArray = {1,2,3,4,5,6,7,8,9,10};

基于范围的for循环遍历

vector<int> intArray = {1,2,3,4,5,6,7,8,9,10};for (int& node : intArray){std::cout << node << endl;}

枚举

enum class ECustomMode{    None,    Custom_1,};ECustomMode mode = ECustomMode::Custom_1;