- A+

Category：Languages

Looking at the documentation for `std::forward`

,

`template< class T > constexpr T&& forward( typename std::remove_reference<T>::type& t ) noexcept; template< class T > constexpr T&& forward( typename std::remove_reference<T>::type&& t ) noexcept; `

Both functions return `T&&`

, which (correct me if I'm wrong) collapses to

`T&`

if`T`

is an lvalue reference`T&&`

if`T`

is an rvalue reference, or if`T`

is not a reference

For an arbitrary type `T`

which may be a reference, does reference collapsing always cause `forward<T>`

to do the same as `forward<T&&>`

?

If so, is there any reason to use `forward<T&&>`

?

Does reference collapsing always cause

`forward<T>`

to do the same as`forward<T&&>`

?

Yes.

[I]s there any reason to use

`forward<T&&>`

?

No.

Note that this is assuming that the only `forward`

s in view are the two overloads you showed in `std::`

.