|
|
template<typename U1 = T1, typename U2 = T2, enable_if_t< conjunction< is_default_constructible< U1 >, is_default_constructible< U2 > >::value &&!conjunction< is_implicitly_default_constructible< U1 >, is_implicitly_default_constructible< U2 > >::value, int > = 0> |
| | pair () noexcept(conjunction< is_nothrow_default_constructible< U1 >, is_nothrow_default_constructible< U2 > >::value) |
| | 显式默认构造函数
|
|
template<typename U1 = T1, typename U2 = T2, enable_if_t< conjunction< is_default_constructible< U1 >, is_default_constructible< U2 > >::value &&conjunction< is_implicitly_default_constructible< U1 >, is_implicitly_default_constructible< U2 > >::value, int > = 0> |
| | pair () noexcept(conjunction< is_nothrow_default_constructible< U1 >, is_nothrow_default_constructible< U2 > >::value) |
| | 隐式默认构造函数
|
|
template<typename U1 = T1, typename U2 = T2, enable_if_t< conjunction< is_copy_constructible< U1 >, is_copy_constructible< U2 > >::value &&!conjunction< is_convertible< const U1 &, U1 >, is_convertible< const U2 &, U2 > >::value, int > = 0> |
| | pair (const T1 &a, const T2 &b) noexcept(conjunction< is_nothrow_copy_constructible< U1 >, is_nothrow_copy_constructible< U2 > >::value) |
| | 显式拷贝构造函数
|
|
template<typename U1 = T1, typename U2 = T2, enable_if_t< conjunction< is_copy_constructible< U1 >, is_copy_constructible< U2 > >::value &&conjunction< is_convertible< const U1 &, U1 >, is_convertible< const U2 &, U2 > >::value, int > = 0> |
| | pair (const T1 &a, const T2 &b) noexcept(conjunction< is_nothrow_copy_constructible< U1 >, is_nothrow_copy_constructible< U2 > >::value) |
| | 隐式拷贝构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, U1 >, is_constructible< T2, U2 > >::value &&!conjunction< is_convertible< U1, T1 >, is_convertible< U2, T2 > >::value, int > = 0> |
| | pair (U1 &&a, U2 &&b) noexcept(conjunction< is_nothrow_constructible< T1, U1 >, is_nothrow_constructible< T2, U2 > >::value) |
| | 显式通用值构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, U1 >, is_constructible< T2, U2 > >::value &&conjunction< is_convertible< U1, T1 >, is_convertible< U2, T2 > >::value, int > = 0> |
| | pair (U1 &&a, U2 &&b) noexcept(conjunction< is_nothrow_constructible< T1, U1 >, is_nothrow_constructible< T2, U2 > >::value) |
| | 隐式通用值构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, const U1 & >, is_constructible< T2, const U2 & > >::value &&!conjunction< is_convertible< const U1 &, T1 >, is_convertible< const U2 &, T2 > >::value, int > = 0> |
| | pair (const pair< U1, U2 > &p) noexcept(conjunction< is_nothrow_constructible< T1, const U1 & >, is_nothrow_constructible< T2, const U2 & > >::value) |
| | 显式拷贝pair构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, const U1 & >, is_constructible< T2, const U2 & > >::value &&conjunction< is_convertible< const U1 &, T1 >, is_convertible< const U2 &, T2 > >::value, int > = 0> |
| | pair (const pair< U1, U2 > &p) noexcept(conjunction< is_nothrow_constructible< T1, const U1 & >, is_nothrow_constructible< T2, const U2 & > >::value) |
| | 隐式拷贝pair构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, U1 >, is_constructible< T2, U2 > >::value &&!conjunction< is_convertible< U1, T1 >, is_convertible< U2, T2 > >::value, int > = 0> |
| | pair (pair< U1, U2 > &&p) noexcept(conjunction< is_nothrow_constructible< T1, U1 >, is_nothrow_constructible< T2, U2 > >::value) |
| | 显式移动pair构造函数
|
|
template<typename U1, typename U2, enable_if_t< conjunction< is_constructible< T1, U1 >, is_constructible< T2, U2 > >::value &&conjunction< is_convertible< U1, T1 >, is_convertible< U2, T2 > >::value, int > = 0> |
| | pair (pair< U1, U2 > &&p) noexcept(conjunction< is_nothrow_constructible< T1, U1 >, is_nothrow_constructible< T2, U2 > >::value) |
| | 隐式移动pair构造函数
|
|
| pair (const pair &p)=default |
| | 默认拷贝构造函数
|
|
| pair (pair &&p)=default |
| | 默认移动构造函数
|
| template<typename Tuple1, typename Tuple2, size_t... Index1, size_t... Index2> |
| constexpr | pair (Tuple1 &t1, Tuple2 &t2, index_sequence< Index1... > idx1, index_sequence< Index2... > idx2) |
| | 从两个tuple构造pair
|
| template<typename... Types1, typename... Types2> |
| constexpr | pair (unpack_utility_construct_tag, tuple< Types1... > t1, tuple< Types2... > t2) |
| | 从两个tuple构造pair
|
| template<typename T = pair, enable_if_t< conjunction< is_copy_assignable< typename T::first_type >, is_copy_assignable< typename T::second_type > >::value, int > = 0> |
| MSTL_CONSTEXPR14 pair & | operator= (type_identity_t< const T & > p) noexcept(conjunction< is_nothrow_copy_assignable< T1 >, is_nothrow_copy_assignable< T2 > >::value) |
| | 拷贝赋值运算符
|
| template<typename T = pair, enable_if_t< conjunction< is_move_assignable< typename T::first_type >, is_move_assignable< typename T::second_type > >::value, int > = 0> |
| MSTL_CONSTEXPR14 pair & | operator= (type_identity_t< T && > p) noexcept(conjunction< is_nothrow_move_assignable< T1 >, is_nothrow_move_assignable< T2 > >::value) |
| | 移动赋值运算符
|
| template<typename U1, typename U2, enable_if_t< conjunction< negation< is_same< pair, pair< U1, U2 > > >, is_assignable< T1 &, const U1 & >, is_assignable< T2 &, const U2 & > >::value, int > = 0> |
| MSTL_CONSTEXPR14 pair & | operator= (const pair< U1, U2 > &p) noexcept(conjunction< is_nothrow_assignable< T1 &, const U1 & >, is_nothrow_assignable< T2 &, const U2 & > >::value) |
| | 从不同类型pair的拷贝赋值运算符
|
| template<typename U1, typename U2, enable_if_t< conjunction< negation< is_same< pair, pair< U1, U2 > > >, is_assignable< T1 &, U1 >, is_assignable< T2 &, U2 > >::value, int > = 0> |
| MSTL_CONSTEXPR14 pair & | operator= (pair< U1, U2 > &&p) noexcept(conjunction< is_nothrow_assignable< T1 &, U1 >, is_nothrow_assignable< T2 &, U2 > >::value) |
| | 从不同类型pair的移动赋值运算符
|
|
pair & | operator= (const volatile pair &)=delete |
| | 禁止volatile拷贝赋值
|
|
MSTL_CONSTEXPR20 | ~pair ()=default |
| | 析构函数
|
| constexpr bool | operator== (const pair &y) const noexcept(noexcept(this->first==y.first &&this->second==y.second)) |
| | 相等比较运算符
|
| constexpr bool | operator< (const pair &y) const noexcept(noexcept(this->first< y.first||(!(y.first< this->first) &&this->second< y.second))) |
| | 小于比较运算符
|
| MSTL_NODISCARD constexpr size_t | to_hash () const noexcept(noexcept(hash< remove_cvref_t< T1 > >()(first) ^ hash< remove_cvref_t< T2 > >()(second))) |
| | 计算hash值
|
| MSTL_CONSTEXPR14 void | swap (pair &p) noexcept(conjunction< is_nothrow_swappable< T1 >, is_nothrow_swappable< T2 > >::value) |
| | 交换两个pair的内容
|
| MSTL_NODISCARD constexpr bool | operator== (const pair< T1, T2 > &rhs) const noexcept(noexcept(derived()==rhs)) |
| | 相等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator!= (const pair< T1, T2 > &rhs) const noexcept(noexcept(!(*this==rhs))) |
| | 不等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator< (const pair< T1, T2 > &rhs) const noexcept(noexcept(derived()< rhs)) |
| | 小于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator> (const pair< T1, T2 > &rhs) const noexcept(noexcept(rhs< derived())) |
| | 大于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator<= (const pair< T1, T2 > &rhs) const noexcept(noexcept(!(derived() > rhs))) |
| | 小于等于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator>= (const pair< T1, T2 > &rhs) const noexcept(noexcept(!(derived()< rhs))) |
| | 大于等于比较运算符
|
| MSTL_NODISCARD constexpr size_t | to_hash () const noexcept(noexcept(derived().to_hash())) |
| | 获取对象的哈希值
|
template<typename T1, typename T2>
class pair< T1, T2 >
存储两个值的元组对
- 模板参数
-
pair是一个可以存储两个不同类型的值的模板类,常用于返回多个值。 支持tuple-like接口,可用于结构化绑定。
在文件 pair.hpp 第 90 行定义.