Unpack compound values (pairs, tuples, arrays, objects, structs) into named variables in a single declaration. Eliminates index noise and .first/.second boilerplate.
pair / tuple pair / tuple
auto [x, y] = std::pair{1, 2};
auto [name, age] = std::tuple{"alice", 30};
map iteration
for (auto& [key, val] : my_map) {
std::cout << key << ": " << val << '\n';
}
insert result
auto [it, inserted] = my_set.insert(42);
if (inserted) { /* new element */ }
plain aggregate struct
struct Point { int x, y; };
auto [px, py] = Point{3, 4};
Warning
C++ binding are copies by default. Use auto& in loops to avoid copying every element. Use const auto& when mutation isn't needed.