C++ › Casting & Conversions

What is std::move and is it a cast?

Beginner

Answer

std::move doesn't move anything—it's a cast that unconditionally converts its argument to an rvalue reference (T&&), signaling that the object may be 'moved from'. This lets overload resolution pick move constructors/assignment. The actual moving is done by those move operations, not by std::move itself.
std::string a = "hi";
std::string b = std::move(a); // a is now moved-from
Real-world example std::move on a large temporary vector enables a cheap move instead of a deep copy into a container.

Common follow-ups: Does std::move perform the move? | What does it cast to?