liveBook · Manning

Rvalue reference

An rvalue reference is a C++ reference type, written with &&, that binds to rvalues, including temporary objects, and supports moving resources from them.

How 2 Manning books explain it

100 C++ Mistakes and How to Avoid Them

An rvalue reference is a C++ reference type that can bind to temporary or otherwise movable expressions and enable resource transfer.

How it is used
Uses rvalue references to transfer resources efficiently and reduce unnecessary copying in modern C++ object handling.
How deep it goes
Defines &&, rvalues, move constructors, and source invalidation through contrasting Page implementations, without broader language internals.
Examples
Uses Page and TextSection examples to contrast expensive copying with pointer transfer through Page(Page&&) and std::move.
What you can do after
Apply it via move constructors and move assignment operators to transfer resources while invalidating moved-from objects.

Read how 100 C++ Mistakes and How to Avoid Them explains rvalue reference →

Learn C++ by Example

An rvalue reference is a C++ reference type, written with &&, that can bind to an rvalue.

How it is used
Avoids unnecessary copies when inserting temporary objects into vectors.
How deep it goes
Explains lvalues, rvalues, overloads, and move construction, while deferring complete value-category details.
Examples
Uses temporary vectors, get_next_row, triangle generation, push_back overloads, and emplace_back.
What you can do after
Apply it via vector insertion and move construction to avoid copying temporary vectors.

Read how Learn C++ by Example explains rvalue reference →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.