706. make_pair() should behave as make_tuple() wrt. reference_wrapper()

Section: 23.4 [pairs] Status: CD1 Submitter: Thorsten Ottosen Opened: 2007-07-08 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [pairs].

View all issues with CD1 status.


The current draft has make_pair() in 23.4 [pairs]/16 and make_tuple() in [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 23.2 [utility] change the synopsis for make_pair() to read

template <class T1, class T2>
  pair<typename decay<T1>::type V1, typename decay<T2>::type V2> make_pair(T1&&, T2&&);

In 23.4 [pairs]/16 change the declaration to match the above synopsis. Then change the 23.4 [pairs]/17 to:

Returns: pair<typename decay<T1>::type V1,typename decay<T2>::type V2>(forward<T1>(x),forward<T2>(y)) where V1 and V2 are determined as follows: Let Ui be decay<Ti>::type for each Ti. Then each Vi is X& if Ui equals reference_wrapper<X>, otherwise Vi is Ui.