Often, a function will return multiple values packed in a structure. In good old C++ you need to assign it to a struct variable and access the individual members from there. In pre-C++17, however, you need to assign the return value to a struct variable and access the individual elements (as shown below). This article aims to demonstrate how structured binding allows you to initialize multiple variables with individual elements of a structure, tuple, or array.

#cpp17 #structural #binding

C++17 Structural Binding
1.10 GEEK