In [dcl.struct.bind] 9.6.4, there is definition of structured binding when initializer is a class type with std::tuple_size<E>::value
properly defined:
... variables are introduced with unique names ri as follows:
S Ui ri = initializer ;
Each vi is the name of an lvalue of type Ti that refers to the object bound to ri; the referenced type is Ti.
My question is why is it necessary to introduce ri, can't we define the identifier vi directly as reference to the result of get<i>(e)
?
CodePudding user response:
The intent is to disallow redeclaring structured bindings as references. See CWG 2313.