Skip to content

What's new in C++17

Structured Bindings

auto [a, b, c] = tuple('a', 1, 0.5);
map<int, int> mymap = {{1, 2}, {3, 4}};

for (const auto& [key, value] : mymap) {
    // ...
}
for (auto [a, b] = tuple(0, 'a'); a < 5; a++) {
    // ...
}

Template Argument Deduction

auto p = pair(2, 4.5);
auto p = pair<int, double>(2, 4.5);

Selection Initialization

if (auto a = getval(); a < 10) {
    // ...
}
switch (auto ch = getnext(); ch) {
    // ...
}