Search⌘ K
AI Features

The Syntax

Understand the syntax of structured bindings in C++17, where the compiler creates aliases to elements of an object. Explore how identifiers are introduced into the surrounding scope and how temporary objects enable this functionality, enhancing the language's expressiveness and readability.

We'll cover the following...

The basic syntax for structured bindings is as follows:

C++
auto [a, b, c, ...] = expression;
auto [a, b, c, ...] { expression };
auto [a, b, c, ...] ( expression );

The compiler introduces all identifiers from the a, b, c, ... list as names in the surrounding scope and binds them to ...