"structured bindings" and "decomposition declarations"

remarks:

Expansion declarations. [..] Originally called "structured bindings".

[..] C ++ 17 decomposition declarations (function formerly known as "structured bindings").

Questions:

  • Which of these two is the correct and modern term that we should use?
  • Why are there two names for the same concept?
  • If decomposition declarations are indeed renamed structured bindings, what is the reason?
+3


source to share


1 answer


The new correct name will be "structured binding declaration" based on the wording in P0615 . Mainly in:

auto [x,y] = Point(4,2);

      

Full operator known as "classified structured binding", as identifiers x

and y

are known as "structured binding". These will be the official terms in C ++ 17. Indeed, the last design section is now called Structured Binding Declarations .




The problem is that there are two concepts that need two different names, so in the original version a decomposition declaration was used to declare the declaration (the term "structured binding" does not appear in the wording at all). However, for most users this is silly because there is only one concept - structured binding - so having two different names is harder to learn. It is especially confusing if the compiler error messages used "decomposition declarations" in their messages. Regardless of the use of the term "decomposition declaration", the function name has always been structured binding.

In Kona, the EWG decided to stick with two names, but at least they were closely related to each other.

+7


source







All Articles