template <classT1, classT2> pair<V1,V2> make_pair (T1&& x, T2&& y); // see below for definition of V1 and V2 The function returns: pair<V1,V2>(std::forward<T1>(x),std::forward<T2>(y))
Where the types V1 and V2 are the decay(衰变) equivalents(等价物) of T1 and T2, respectively(分别) (except for reference_wrapper types, for which the corresponding reference type is used instead).
If T1 and/or T2 are rvalue references, the objects are moved and x and/or y are left in an undefined but valid state.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// make_pair example #include<utility>// std::pair #include<iostream>// std::cout