This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
make_pair()
should behave as make_tuple()
wrt. reference_wrapper()
Section: 22.3 [pairs] Status: CD1 Submitter: Thorsten Ottosen Opened: 2007-07-08 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [pairs].
View all issues with CD1 status.
Discussion:
The current draft has make_pair()
in 22.3 [pairs]/16
and make_tuple()
in 22.4.5 [tuple.creation].
make_tuple()
detects the presence of
reference_wrapper<X>
arguments and "unwraps" the reference in
such cases. make_pair()
would OTOH create a
reference_wrapper<X>
member. I suggest that the two
functions are made to behave similar in this respect to minimize
confusion.
Proposed resolution:
In 22.2 [utility] change the synopsis for make_pair() to read
template <class T1, class T2> pair<typename decay<T1>::typeV1,typename decay<T2>::typeV2> make_pair(T1&&, T2&&);
In 22.3 [pairs]/16 change the declaration to match the above synopsis. Then change the 22.3 [pairs]/17 to:
Returns:
pair<
wheretypename decay<T1>::typeV1,typename decay<T2>::typeV2>(forward<T1>(x),forward<T2>(y))V1
andV2
are determined as follows: LetUi
bedecay<Ti>::type
for eachTi
. Then eachVi
isX&
ifUi
equalsreference_wrapper<X>
, otherwiseVi
isUi
.