1#ifndef MSTL_CORE_UTILITY_COMPRESSED_PAIR_HPP__
2#define MSTL_CORE_UTILITY_COMPRESSED_PAIR_HPP__
30template <
typename IfEmpty,
typename T,
bool Compressed = is_empty_v<IfEmpty> && !is_final_v<IfEmpty>>
40 noexcept(is_nothrow_default_constructible_v<T>) = default;
47 noexcept(is_nothrow_copy_constructible_v<T>) :
value(p.
value) {}
55 noexcept(is_nothrow_copy_assignable_v<T>) {
73 noexcept(is_nothrow_move_assignable_v<T>) {
85 template <
typename... Args,
enable_if_t<is_constructible_v<T, Args...>,
int> = 0>
99 template <
typename ToEmpty,
typename... Args,
enable_if_t<conjunction_v<
126 noexcept(is_nothrow_swappable_v<T>) {
145 noexcept(
noexcept(this->
value == y.value)) {
146 return this->
value == y.value;
155 noexcept(
noexcept(this->
value < y.value)) {
156 return this->
value < y.value;
167template <
typename IfEmpty,
typename T>
176 noexcept(conjunction_v<
186 noexcept(conjunction_v<
197 noexcept(conjunction_v<
210 noexcept(conjunction_v<
221 noexcept(conjunction_v<
234 template <
typename... Args>
236 noexcept(conjunction_v<
248 template <
typename ToEmpty,
typename... Args>
250 noexcept(conjunction_v<
268 constexpr const IfEmpty&
get_base() const noexcept {
287 noexcept(noexcept(
hash<IfEmpty>{}(no_compressed) ^
hash<T>{}(value))) {
297 noexcept(
noexcept(this->
no_compressed == y.no_compressed && this->
value == y.value)) {
313#if MSTL_SUPPORT_DEDUCTION_GUIDES__
314template <
typename IfEmpty,
typename T>
MSTL_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
bool operator==(const function< Res(Args...)> &f, nullptr_t null) noexcept
等于空指针比较
#define _MSTL
全局命名空间MSTL前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_NODISCARD constexpr bool operator<(const normal_iterator< LeftIter > &lhs, const normal_iterator< RightIter > &rhs) noexcept
小于比较运算符
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result)
移动范围元素
void swap()=delete
删除无参数的swap重载
typename enable_if< Test, T >::type enable_if_t
enable_if的便捷别名
constexpr const IfEmpty & get_base() const noexcept
获取基类常量引用
constexpr void swap(compressed_pair &rhs) noexcept(conjunction_v< is_nothrow_swappable< IfEmpty >, is_nothrow_swappable< T > >)
交换两个压缩对
constexpr compressed_pair(default_construct_tag, Args &&... args) noexcept(conjunction_v< is_nothrow_default_constructible< IfEmpty >, is_nothrow_constructible< T, Args... > >)
默认构造标签构造函数
constexpr compressed_pair(compressed_pair &&pir) noexcept(conjunction_v< is_nothrow_move_constructible< IfEmpty >, is_nothrow_move_constructible< T > >)
移动构造函数
constexpr size_t to_hash() const noexcept(noexcept(hash< IfEmpty >{}(no_compressed) ^ hash< T >{}(value)))
计算哈希值
constexpr compressed_pair(exact_arg_construct_tag, ToEmpty &&first, Args &&... args) noexcept(conjunction_v< is_nothrow_constructible< IfEmpty, ToEmpty >, is_nothrow_constructible< T, Args... > >)
精确参数构造标签构造函数
IfEmpty no_compressed
未压缩的基类成员
constexpr IfEmpty & get_base() noexcept
获取基类引用
constexpr compressed_pair() noexcept(conjunction_v< is_nothrow_default_constructible< IfEmpty >, is_nothrow_default_constructible< T > >)=default
默认构造函数
constexpr void swap(compressed_pair &rhs) noexcept(is_nothrow_swappable_v< T >)
交换两个压缩对
constexpr compressed_pair(compressed_pair &&p) noexcept(is_nothrow_move_constructible_v< T >)
移动构造函数
constexpr compressed_pair(default_construct_tag, Args &&... args) noexcept(conjunction_v< is_nothrow_default_constructible< IfEmpty >, is_nothrow_constructible< T, Args... > >)
默认构造标签构造函数
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))
相等比较运算符
constexpr compressed_pair & operator=(const compressed_pair &pir) noexcept(is_nothrow_copy_assignable_v< T >)
拷贝赋值运算符
constexpr compressed_pair & get_base() noexcept
获取基类引用
constexpr const compressed_pair & get_base() const noexcept
获取基类常量引用
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 size_t to_hash() const noexcept(noexcept(hash< T >{}(value)))
计算哈希值
constexpr compressed_pair() noexcept(is_nothrow_default_constructible_v< T >)=default
默认构造函数