【程式語言】What's new in C++17
Structured Bindings
1 | auto [a, b, c] = tuple('a', 1, 0.5); |
1 | map<int, int> mymap = {{1, 2}, {3, 4}}; |
1 | for (auto [a, b] = tuple(0, 'a'); a < 5; a++) { |
Template Argument Deduction
1 | auto p = pair(2, 4.5); |
1 | auto p = pair<int, double>(2, 4.5); |
Selection Initialization
1 | if (auto a = getval(); a < 10) { |
1 | switch (auto ch = getnext(); ch) { |