Following on from a comment I made on this:
passing std::vector to constructor and move semantics
Is the std::move necessary in the following code, to e
I think the answer is no. Though officially only a note, §5/6 summarizes what expressions are/aren't xvalues:
An expression is an xvalue if it is:
- the result of calling a function, whether implicitly or explicitly, whose return type is an rvalue reference to object type,
- a cast to an rvalue reference to object type,
- a class member access expression designating a non-static data member of non-reference type in which the object expression is an xvalue, or
- a .* pointer-to-member expression in which the first operand is an xvalue and the second operand is a pointer to data member.
In general, the effect of this rule is that named rvalue references are treated as lvalues and unnamed rvalue references to objects are treated as xvalues; rvalue references to functions are treated as lvalues whether named or not.
The first bullet point seems to apply here. Since the function in question returns a value rather than an rvalue reference, the result won't be an xvalue.