When the compiler changes ‘references to
references’ into ‘references’ in certain situations.
Example:
Typedef A B;
Typedef B C;
C
var; // Var is type A
--
Typedef A& B;
Typedef B C;
C
var; // Var is type A&
--
Typedef A B;
Typedef B& C;
C
var; // Var is type A&
--
Typedef A& B;
Typedef B& C;
C
var; // Var is type A&
--
Typedef A&& B;
Typedef B&& C;
C
var; // Var is type A&&
--
Reference collapsing can also happen
with decltype specifiers and template type parameters. Reference Collapsing for
References (&) existed pre-C++11.
Reference Collapsing for Rvalue References was added in C++11.
https://www.ibm.com/support/knowledgecenter/en/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/reference_collapsing.html
No comments:
Post a Comment