Skip to content
Deepanshu Upadhyay
Back to notes

std::move Is Just a Cast

  • C++
  • Move Semantics
Deepanshu Upadhyay
Deepanshu Upadhyay

November 23, 2026 · 1 min read

One of the most common misconceptions in C++ is that std::move actually moves an object.

It doesn't.

std::move is essentially a cast that converts an expression into an rvalue (more precisely, an xvalue), allowing move constructors and move assignment operators to be selected during overload resolution.

Consider:

std::string first = "Hello";
std::string second = std::move(first);

What actually happens?

  1. std::move(first) casts first to an rvalue reference.
  2. The compiler selects std::string's move constructor.
  3. The move constructor performs the actual transfer of resources.

Without a suitable move constructor, std::move alone won't magically move anything. A copy might happen instead.

The interesting distinction: std::move doesn't move resources. It simply tells the compiler that an object can be treated as an expiring value, making move semantics possible.

Think of it as permission to move, not the act of moving.