Structured bindings are always applied with the same pattern:
auto [var1, var2, ...] = <pair, tuple, struct, or array expression>;
- The list of variables var1, var2, ... must exactly match the number of variables contained by the expression being assigned from.
- The <pair, tuple, struct, or array expression> must be one of the following:
- An std::pair.
- An std::tuple.
- A struct. All members must be non-static and defined in the same base class. The first declared member is assigned to the first variable, the second member to the second variable, and so on.
- An array of fixed size.
- The type can be auto, const auto, const auto&, and even auto&&.
Not only for the sake of performance, always make sure to minimize needless copies ...