operator==, <=>(std::reference_wrapper)
From cppreference.com
 
 
 < cpp | utility | functional | reference wrapper 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Utilities library 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
Relational operators (deprecated in C++20) Integer comparison functions  
 
 
 
 Swap and type operations  Common vocabulary types 
 Type support (basic types, RTTI)
 Library feature-test macros (C++20)
(C++11)
(C++20)
(C++26)
(C++20)
 Coroutine support (C++20)
 Contract support (C++26)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
  (C++20)(C++20)(C++20)
  (C++20)(C++20)(C++20)
 General utilities
(C++20)(C++20)(C++20)
  (C++20)(C++20)(C++20)
(C++20)
Function objects 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Old binders and adaptors  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
(C++11)
(C++23)
(C++26)
(C++26)
(C++11)
(C++11)
(C++20)(C++23)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++20)(C++20)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++17)
(C++17)
(C++17)
(C++17)    
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)  
(until C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(until C++20*)
(until C++20*)
(until C++17*)(until C++17*)
(until C++17*)(until C++17*)
(until C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(until C++20*)
(until C++20*)
std::reference_wrapper 
 
 Member functions
 Non-member functions
operator==operator<=>
(C++26)(C++26)
 Deduction guides (C++17)
 Helper classes
friend constexpr bool
operator==( reference_wrapper lhs, reference_wrapper rhs );
 (1) 
 (since C++26) 
operator==( reference_wrapper lhs, reference_wrapper rhs );
friend constexpr bool
operator==( reference_wrapper lhs, reference_wrapper<const T> rhs );
 (2) 
 (since C++26) 
operator==( reference_wrapper lhs, reference_wrapper<const T> rhs );
friend constexpr bool
operator==( reference_wrapper lhs, const T& ref );
 (3) 
 (since C++26) 
operator==( reference_wrapper lhs, const T& ref );
friend constexpr auto
operator<=>( reference_wrapper lhs, reference_wrapper rhs );
 (4) 
 (since C++26) 
operator<=>( reference_wrapper lhs, reference_wrapper rhs );
friend constexpr auto
operator<=>( reference_wrapper lhs, reference_wrapper<const T> rhs );
 (5) 
 (since C++26) 
operator<=>( reference_wrapper lhs, reference_wrapper<const T> rhs );
friend constexpr auto
operator<=>( reference_wrapper lhs, const T& ref );
 (6) 
 (since C++26) 
operator<=>( reference_wrapper lhs, const T& ref );
Performs comparison operations on reference_wrapper objects.
1,2) Compares two 
reference_wrapper objects. The objects compare equal if and only if lhs.get() and rhs.get() are equal.1) This overload participates in overload resolution only if the expression lhs.get() == rhs.get() is well-formed and its result is convertible to bool.
2) This overload participates in overload resolution only if all following conditions are satisfied:
- std::is_const_v <T> is false.
- The expression lhs.get() == rhs.get() is well-formed and its result is convertible to bool.
3) Compares 
reference_wrapper object with a reference. The parameters compare equal if and only if lhs.get() is equal to ref. This overload participates in overload resolution only if the expression lhs.get() == ref is well-formed and its result is convertible to bool.
4) This overload participates in overload resolution only if the expression synth-three-way (lhs.get(), rhs.get()) is well-formed.
5) This overload participates in overload resolution only if all following conditions are satisfied:
- std::is_const_v <T> is false.
- The expression synth-three-way (lhs.get(), rhs.get()) is well-formed.
 This overload participates in overload resolution only if the expression synth-three-way (lhs.get(), ref) is well-formed.
The <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively.
[edit] Parameters
 lhs, rhs
 -
 
reference_wrapper object to compare
 ref
 -
 reference to compare to the 
reference_wrapper object
[edit] Return value
1,2) lhs.get() == rhs.get().
3) lhs.get() == ref.
4,5) synth-three-way (lhs.get(), rhs.get()).
6) synth-three-way (lhs.get(), ref).
[edit] Exceptions
Throws when and what the comparison throws.
[edit] Notes
The return types of operator<=> are deduced from return statements to avoid hard error when instantiating a std::reference_wrapper <T> with synth-three-way-result<T> being ill-formed.
| Feature-test macro | Value | Std | Feature | 
|---|---|---|---|
| __cpp_lib_reference_wrapper | 202403L | (C++26) | Comparisons for std::reference_wrapper | 
[edit] Example
 This section is incomplete
Reason: no example
Reason: no example