跳转至

c++11语法限制

整理一些c++11的语法限制

结构化绑定

嗯就是不能用结构化绑定,结构化绑定为c++17

递归的lambda匿名函数

改成使用std::function显式声明函数类型

function<int(int, int)> func = [&](int a, int b) {
    if (m == 1) return 1;
    return 1 + func(m - 1, n - 1);
}; 

auto 是可以用的

map<int, string> my_map;

for (auto& kv : my_map) {
    cout << kv.first << ' ' << kv.second << endl;
}

for (auto it = my_map.begin(); it != my_map.end(); it++) {
    cout << it->first << endl;
}