|
|
|
|
|
by lorenzhs
3572 days ago
|
|
I think the example with function application is a bad one here - moving the element potentially leaves it in an undefined state. It would be a better example if the code did something with x instead of calling a function on it. So I don't think you'd want to forward it. Note that you also need the element's type to forward it, which isn't possible in general with the example's signature. |
|
void somefunction(int && i) // i is an rvalue reference
template<typename T> void somefunction2(T && i) // i is a universal reference
It might be a similar thing with auto&&. So I would tentatively agree that std::forward should be used.