Friday, 27 September 2013

Why does std::make_tuple turn std::reference_wrapper arguments into X?

Why does std::make_tuple turn std::reference_wrapper arguments into X?

In the C++11 standard it states that (see cppreference.com, see also
section 20.4.2.4 of the standard) it states that
template< class... Types >
tuple<VTypes...> make_tuple( Types&&... args );
Creates a tuple object, deducing the target type from the types of arguments.
For each Ti in Types..., the corresponding type Vi in Vtypes... is
std::decay<Ti>::type unless application of std::decay results in
std::reference_wrapper<X> for some type X, in which case the deduced type
is X&.
I am wondering: Why are reference wrappers treated special here?

No comments:

Post a Comment