I\'m struggling to understand what exactly happens when passing a reference-to-function to a function as a universal reference (what type is being deduced). Let\'s suppose w
A std::move
is a glorified static_cast
to rvalue reference type. The standard says that casting to an rvalue reference to function type still yields an lvalue. Per [expr.static.cast]/p1:
The result of the expression
static_cast
is the result of converting the expression(v) v
to typeT
. IfT
is an lvalue reference type or an rvalue reference to function type, the result is an lvalue;
Concerning the value category of the std::move()
function call, which returns an rvalue reference designating the result of the conversion, we can also see from [expr.call]/p10 that a function call is an lvalue if its return type is an rvalue reference to function type:
A function call is an lvalue if the result type is an lvalue reference type or an rvalue reference to function type, an xvalue if the result type is an rvalue reference to object type, and a prvalue otherwise.