Namespaces
Variants

std::pmr:: operator==, std::pmr:: operator!=

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
ヘッダーで定義 <memory_resource>
template < class T1, class T2 >

bool operator == ( const std:: pmr :: polymorphic_allocator < T1 > & lhs,

const std:: pmr :: polymorphic_allocator < T2 > & rhs ) noexcept ;
(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,

const std:: pmr :: polymorphic_allocator < T2 > & rhs ) noexcept ;
(3) (C++17以降)
(C++20以前)
friend bool operator ! = ( const polymorphic_allocator & lhs,
const polymorphic_allocator & rhs ) noexcept ;
(4) (C++17以降)
(C++20以前)

2つのポリモーフィックアロケータを比較します。基盤となるメモリリソースが等しい場合、2つのポリモーフィックアロケータは等しいと比較されます。

1) *lhs.resource() == *rhs.resource() を返します。
2) (1) と同様、 polymorphic_allocator への変換を許可します。
この関数は通常の unqualified lookup または qualified lookup では可視化されず、引数に関連付けられたクラスとして std::pmr::polymorphic_allocator が存在する場合にのみ argument-dependent lookup によって発見されます。
3) 戻り値 ! ( lhs == rhs ) .
4) (3) と同様、 polymorphic_allocator への変換を許可します。
この関数は通常の unqualified lookup または qualified lookup では可視化されず、引数に関連付けられたクラスとして std::pmr::polymorphic_allocator が存在する場合にのみ argument-dependent lookup によって発見されます。

!= 演算子は operator== から合成されます

(C++20以降)

パラメータ

lhs, rhs - 比較するポリモーフィックアロケータ

戻り値

1,2) * lhs. resource ( ) == * rhs. resource ( )
3,4) ! ( lhs == rhs )

欠陥報告

以下の動作変更に関する欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 3683 C++17 polymorphic_allocator は変換可能な型と比較できなかった オーバーロードを追加