I do understand the nature of std::forward
when it comes to, well, forwarding a lvalue argument as a lvalue or rvalue, depending on the template parameter's "value-ness".
But I just noticed that this page of cppreference.com contains the other way of using it, namely with rvalues. Declaration is as follows:
template< class T >
T&& forward( typename std::remove_reference<T>::type&& t ) noexcept;
//note double ampersand
And the brief description is like this:
- Forwards rvalues as rvalues and prohibits forwarding of rvalues as lvalues
What problem does it solve? The only reason I was able to come up with is that it may be used as an additional check for correctness of wrapper function call, that is, if I plan to supply the internal function with an rvalue, then the wrapper should be called solely with an rvalue.