std::pmr::operator==, std::pmr::operator!=
來自 cppreference.com
< 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 無法與可轉換為它的型別進行比較 |
添加了過載 |