Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Unconditionally casts its argument to an rvalue reference, and thereby signals that it can be moved if its type is move-enabled.

template<class Type>
    typename remove_reference<Type>::type&& move(Type&& Arg) noexcept;




A type deduced from the type of the argument passed in Arg, together with the reference collapsing rules.


The argument to cast. Although the type of Arg appears to be specified as an rvalue reference, move also accepts lvalue arguments because lvalue references can bind to rvalue references.

Arg as an rvalue reference, whether or not its type is a reference type.

The template argument Type is not intended to be specified explicitly, but to be deduced from the type of the value passed in Arg. The type of Type is further adjusted according to the reference collapsing rules.

move does not move its argument. Instead, by unconditionally casting its argument—which might be an lvalue—to an rvalue reference, it enables the compiler to subsequently move, rather than copy, the value passed in Arg if its type is move-enabled. If its type is not move-enabled, it is copied instead.

If the value passed in Arg is an lvalue—that is, it has a name or its address can be taken—it's invalidated when the move occurs. Do not refer to the value passed in Arg by its name or address after it's been moved.

Header: <utility>

Namespace: std

© 2017 Microsoft