Why do rvalue references use && rather than a new symbol?
& is already used when taking the address of a variable, and declaring variable references, so why keep bloating the usage of this symbol instead of using a new symbol?
For example, use A# or A@ instead of A&&.
The benefit of introducing a new symbol:
-
easy to read, as it stands out telling you that this is a new type.
-
it doesn't have the problem of reference collapsing, such as
&&&should be parsed as& &&or&& &?
Why does the C++ standard choose &&?
Aucun commentaire:
Enregistrer un commentaire