Spec-Zone.ru › C++

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

Defined in header <memory>
Compare two indirect objects
template< class U, class A >
constexpr bool operator==( const indirect& lhs, const indirect<U, A>& rhs )
    noexcept(noexcept(*lhs == *rhs));
(1) (since C++26)
template< class U, class A >
constexpr /*synth-three-way-result*/<T, U>
    operator<=>( const indirect& lhs, const indirect<U, A>& rhs );
(2) (since C++26)
Compare an indirect object with a value
template< class U >
constexpr bool operator==( const indirect& ind, const U& value )
    noexcept(noexcept(*lhs == value));
(3) (since C++26)
template< class U >
constexpr /*synth-three-way-result*/<T, U>
    operator<=>( const indirect& ind, const U& value );
(4) (since C++26)

Performs comparison operations on indirect objects.

For the definition of /*synth-three-way-result*/, see synth-three-way-result .

1,2) Compares two indirect objects, the comparison result is defined as follows:
lhs valueless not valueless
rhs valueless not valueless valueless not valueless
operator== true false false *lhs == *rhs
operator<=> !lhs.valueless_after_move() <=>!rhs.valueless_after_move() synth-three-way
    (*lhs,*rhs)
1) If the expression *lhs == *rhs is ill-formed or its result is not convertible to bool, the program is ill-formed.
3,4) Compare an indirect object with a value, the comparison result is defined as follows:
Operator ind is valueless ind is not valueless
operator== false *ind == value
operator<=> std::strong_ordering::less synth-three-way (*ind,value)
3) If the expression *ind == value is ill-formed or its result is not convertible to bool, the program is ill-formed.

Parameters

lhs, rhs, ind - an indirect object to compare
value - value to compare to the owned value

Return value

As described above.

Example

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/memory/indirect/operator_cmp

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API