|
|
constexpr | compressed_pair () noexcept(is_nothrow_default_constructible_v< T >)=default |
| | 默认构造函数
|
| constexpr | compressed_pair (const compressed_pair &p) noexcept(is_nothrow_copy_constructible_v< T >) |
| | 拷贝构造函数
|
| constexpr compressed_pair & | operator= (const compressed_pair &pir) noexcept(is_nothrow_copy_assignable_v< T >) |
| | 拷贝赋值运算符
|
| constexpr | compressed_pair (compressed_pair &&p) noexcept(is_nothrow_move_constructible_v< T >) |
| | 移动构造函数
|
| constexpr compressed_pair & | operator= (compressed_pair &&pir) noexcept(is_nothrow_move_assignable_v< T >) |
| | 移动赋值运算符
|
| template<typename... Args, enable_if_t< is_constructible_v< T, Args... >, int > = 0> |
| constexpr | compressed_pair (default_construct_tag, Args &&... args) noexcept(conjunction_v< is_nothrow_default_constructible< IfEmpty >, is_nothrow_constructible< T, Args... > >) |
| | 默认构造标签构造函数
|
| template<typename ToEmpty, typename... Args, enable_if_t< conjunction_v< is_constructible< IfEmpty, ToEmpty >, is_constructible< T, Args... > >, int > = 0> |
| constexpr | compressed_pair (exact_arg_construct_tag, ToEmpty &&first, Args &&... args) noexcept(conjunction_v< is_nothrow_constructible< IfEmpty, ToEmpty >, is_nothrow_constructible< T, Args... > >) |
| | 精确参数构造标签构造函数
|
| constexpr compressed_pair & | get_base () noexcept |
| | 获取基类引用
|
| constexpr const compressed_pair & | get_base () const noexcept |
| | 获取基类常量引用
|
| constexpr void | swap (compressed_pair &rhs) noexcept(is_nothrow_swappable_v< T >) |
| | 交换两个压缩对
|
| constexpr size_t | to_hash () const noexcept(noexcept(hash< T >{}(value))) |
| | 计算哈希值
|
| constexpr bool | operator== (const compressed_pair &y) const noexcept(noexcept(this->value==y.value)) |
| | 相等比较运算符
|
| constexpr bool | operator< (const compressed_pair &y) const noexcept(noexcept(this->value< y.value)) |
| | 小于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator== (const T &rhs) const noexcept(noexcept(derived()==rhs)) |
| | 相等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator!= (const T &rhs) const noexcept(noexcept(!(*this==rhs))) |
| | 不等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator< (const T &rhs) const noexcept(noexcept(derived()< rhs)) |
| | 小于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator> (const T &rhs) const noexcept(noexcept(rhs< derived())) |
| | 大于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator<= (const T &rhs) const noexcept(noexcept(!(derived() > rhs))) |
| | 小于等于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator>= (const T &rhs) const noexcept(noexcept(!(derived()< rhs))) |
| | 大于等于比较运算符
|
| MSTL_NODISCARD constexpr size_t | to_hash () const noexcept(noexcept(derived().to_hash())) |
| | 获取对象的哈希值
|
template<typename IfEmpty, typename T, bool Compressed = is_empty_v<IfEmpty> && !is_final_v<IfEmpty>>
struct compressed_pair< IfEmpty, T, Compressed >
压缩对主模板,使用EBCO优化
- 模板参数
-
| IfEmpty | 第一个类型,可能为空 |
| T | 第二个类型 |
| Compressed | 是否启用压缩 |
使用空基类优化技术,当第一个类型为空时,通过继承来优化存储空间。
在文件 compressed_pair.hpp 第 31 行定义.