Reference Collapsing Rules

The first of the remaining two rules for rvalue references affects old-style lvalue references as well. Recall that in pre-C++11, it was not allowed to take a reference to a reference: something like A& & would cause a compile error. C++11, by contrast, introduces the following reference collapsing rules:

  • A& & becomes A&
  • A& && becomes A&
  • A&& & becomes A&
  • A&& && becomes A&&

[1] – Rvalue References Explained, by Thomas Becker.

Advertisements
This entry was posted in C++, Computers and tagged . Bookmark the permalink.

One Response to Reference Collapsing Rules

  1. Pingback: Universal Reference | Ilya's Life Weblog

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s