liveBook · Manning

Std::move

std::move is a C++ standard-library function template that casts an expression to an rvalue reference, enabling move operations.

How 3 Manning books explain it

100 C++ Mistakes and How to Avoid Them

std::move is a C++ standard library function template that casts an expression to an rvalue reference to enable move operations.

How it is used
Enables move construction or assignment when transferring resource ownership instead of performing standard copying.
How deep it goes
Explains the cast and moved-from state, then demonstrates pointer transfer in move construction and unique_ptr ownership.
Examples
Uses Page pointer transfer and Buffer ownership transfer through unique_ptr.
What you can do after
Apply std::move to eligible lvalues and handle moved-from objects cautiously during resource ownership transfers.

Read how 100 C++ Mistakes and How to Avoid Them explains std::move →

C++ Concurrency in Action, Second Edition

`std::move` is a C++ standard library function template that casts an expression to an rvalue reference, enabling move operations.

How it is used
Transfers ownership of movable, noncopyable resources such as `std::thread` and `std::unique_ptr`.
How deep it goes
Works through named and temporary sources, ownership changes, and a thread-assignment failure, without detailing move internals.
Examples
Uses thread transfers among three objects and transfers a `std::unique_ptr` into a thread function.
What you can do after
Apply it via `std::move` to transfer ownership from named objects and recognize when thread replacement would terminate.

Read how C++ Concurrency in Action, Second Edition explains std::move →

Learn C++ by Example

std::move is a C++ standard library utility that casts an expression to an rvalue reference to enable moving from it.

How it is used
Enables efficient forwarding into vector operations by selecting rvalue overloads and avoiding unnecessary copies.
How deep it goes
Explains named rvalue references, overload selection, and moved-from states, but deliberately scratches only the surface of perfect forwarding.
Examples
Uses vector insertion, a triangle-row generator, push_back overloads, and direct emplace_back calls.
What you can do after
Apply std::move to forward named values as rvalues and recognize when an operation may move instead of copy.

Read how Learn C++ by Example explains std::move →

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.