Namespaces
Variants

operator==, <=> (std::indirect)

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)
Definiert im Header <memory>
Vergleiche zwei indirect Objekte
template < class U, class A >

constexpr bool operator == ( const indirect & lhs, const indirect < U, A > & rhs )

noexcept ( noexcept ( * lhs == * rhs ) ) ;
(1) (seit C++26)
template < class U, class A >

constexpr /*synth-three-way-result*/ < T, U >

operator <=> ( const indirect & lhs, const indirect < U, A > & rhs ) ;
(2) (seit C++26)
Vergleiche ein indirect Objekt mit einem Wert
template < class U >

constexpr bool operator == ( const indirect & ind, const U & value )

noexcept ( noexcept ( * lhs == value ) ) ;
(3) (seit C++26)
template < class U >

constexpr /*synth-three-way-result*/ < T, U >

operator <=> ( const indirect & ind, const U & value ) ;
(4) (seit C++26)

Führt Vergleichsoperationen auf indirect -Objekten aus.

Für die Definition von /*synth-three-way-result*/ , siehe synth-three-way-result .

1,2) Vergleicht zwei indirect Objekte, das Vergleichsergebnis ist wie folgt definiert:
lhs wertlos nicht wertlos
rhs wertlos nicht wertlos wertlos nicht wertlos
operator == true false false * lhs == * rhs
operator <=> ! lhs. valueless_after_move ( ) <=>
! rhs. valueless_after_move ( )
synth-three-way
( * lhs, * rhs )
1) Wenn der Ausdruck * lhs == * rhs fehlerhaft ist oder sein Ergebnis nicht in bool konvertierbar ist, ist das Programm fehlerhaft.
3,4) Vergleiche ein indirect -Objekt mit einem Wert, das Vergleichsergebnis ist wie folgt definiert:
Operator ind ist wertlos ind ist nicht wertlos
operator == false * ind == value
operator <=> std :: strong_ordering :: less synth-three-way  ( * ind, value )
3) Wenn der Ausdruck * ind == value fehlerhaft ist oder sein Ergebnis nicht in bool konvertierbar ist, ist das Programm fehlerhaft.

Parameter

lhs, rhs, ind - ein indirect Objekt zum Vergleichen
value - Wert zum Vergleich mit dem enthaltenen Wert

Rückgabewert

Wie oben beschrieben.

Beispiel