std::move
itself does nothing rather than a static_cast
. According to cppreference.com
It is exactly equivalent to a static_cast to an rvalue reference type.
Thus, it depends on the type of the variable you assign to after the move
, if the type has constructors
or assign operators
that takes a rvalue parameter, it may or may not steal the content of the original variable, so, it may leave the original variable to be in an unspecified state
:
Unless otherwise specified, all standard library objects that have been moved from being placed in a valid but unspecified state.
Because there is no special move constructor
or move assign operator
for built-in literal types such as integers and raw pointers, so, it will be just a simple copy for these types.