std::pmr::operator==, std::pmr::operator!=
来自 cppreference.cn
< cpp | memory | polymorphic allocator
定义于头文件 <memory_resource> |
||
template< class T1, class T2 > bool operator==( const std::pmr::polymorphic_allocator<T1>& lhs, |
(1) | (C++17 起) |
friend bool operator==( const polymorphic_allocator& lhs, const polymorphic_allocator& rhs ) noexcept; |
(2) | (C++17 起) |
template< class T1, class T2 > bool operator!=( const std::pmr::polymorphic_allocator<T1>& lhs, |
(3) | (C++17 起) (C++20 前) |
friend bool operator!=( const polymorphic_allocator& lhs, const polymorphic_allocator& rhs ) noexcept; |
(4) | (C++17 起) (C++20 前) |
比较两个多态分配器。如果底层内存资源比较相等,则两个多态分配器比较相等。
1) 返回 *lhs.resource() == *rhs.resource()。
2) 同 (1),允许转换为
此函数对于普通的非限定或限定查找不可见,只能在 std::pmr::polymorphic_allocator 是参数的关联类时通过实参依赖查找找到。
polymorphic_allocator
。此函数对于普通的非限定或限定查找不可见,只能在 std::pmr::polymorphic_allocator 是参数的关联类时通过实参依赖查找找到。
3) 返回 !(lhs == rhs)。
4) 同 (3),允许转换为
此函数对于普通的非限定或限定查找不可见,只能在 std::pmr::polymorphic_allocator 是参数的关联类时通过实参依赖查找找到。
polymorphic_allocator
。此函数对于普通的非限定或限定查找不可见,只能在 std::pmr::polymorphic_allocator 是参数的关联类时通过实参依赖查找找到。
|
(C++20 起) |
[编辑] 参数
lhs, rhs | - | 要比较的多态分配器 |
[编辑] 返回值
1,2) *lhs.resource() == *rhs.resource()
3,4) !(lhs == rhs)
[编辑] 缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 发布时的行为 | 正确的行为 |
---|---|---|---|
LWG 3683 | C++17 | polymorphic_allocator 无法与可转换为它的类型进行比较 |
添加了重载 |