23 General utilities library [utilities]

23.4 Pairs [pairs]

23.4.3 Specialized algorithms [pairs.spec]

template <class T1, class T2> constexpr bool operator==(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: x.first == y.first && x.second == y.second.

template <class T1, class T2> constexpr bool operator<(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: x.first < y.first || (!(y.first < x.first) && x.second < y.second).

template <class T1, class T2> constexpr bool operator!=(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: !(x == y).

template <class T1, class T2> constexpr bool operator>(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: y < x.

template <class T1, class T2> constexpr bool operator>=(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: !(x < y).

template <class T1, class T2> constexpr bool operator<=(const pair<T1, T2>& x, const pair<T1, T2>& y);

Returns: !(y < x).

template<class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));

Effects: Как будто мимо x.swap(y).

Remarks: Эта функция не будет участвовать в разрешении перегрузки , если is_­swappable_­v<T1> не true и is_­swappable_­v<T2> является true.

template <class T1, class T2> constexpr pair<V1, V2> make_pair(T1&& x, T2&& y);

Returns: pair<V1, V2>(std​::​forward<T1>(x), std​::​forward<T2>(y)), где V1 и V2 определяются следующим образом: Пусть Ui будет decay_­t<Ti> для каждого Ti. Если Ui является специализацией reference_­wrapper, то Vi есть Ui​::​type&, иначе Vi - Ui.

[ Example: Вместо:

  return pair<int, double>(5, 3.1415926);   // explicit types

программа на C ++ может содержать:

  return make_pair(5, 3.1415926);           // types are deduced

end example]