Reputation: 15
I read std::move() does the same thing*
Upvotes: 0
Views: 242
Reputation: 52591
[expr.static.cast]/1 The result of the expression
static_cast<T>(v)
is the result of converting the expressionv
to typeT
. IfT
is an lvalue reference type or an rvalue reference to function type, the result is an lvalue; ifT
is an rvalue reference to object type, the result is an xvalue; otherwise, the result is a prvalue.
Emphasis mine. Therefore, static_cast<type&&>(x)
, where type
is an object type (as opposed to a function type), is an xvalue by definition.
Upvotes: 1