[libcxx-commits] [libcxx] WIP - [libc++][functional] P2944R3 (partial): Comparisons for ``reference_wrapper`` (``reference_wrapper`` operators only) (PR #88384)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 24 09:55:41 PDT 2024


================
@@ -77,6 +77,15 @@ template <class T> struct unwrap_ref_decay : unwrap_reference<decay_t<T>> { };
 template <class T> using unwrap_reference_t = typename unwrap_reference<T>::type; // since C++20
 template <class T> using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type; // since C++20
 
+// [refwrap.comparisons], comparisons
+friend constexpr bool operator==(reference_wrapper, reference_wrapper);                                // Since C++26
+friend constexpr bool operator==(reference_wrapper, const T&);                                         // Since C++26
+friend constexpr bool operator==(reference_wrapper, reference_wrapper<const T>);                       // Since C++26
+
+friend constexpr synth-three-way-result<T> operator<=>(reference_wrapper, reference_wrapper);          // Since C++26
+friend constexpr synth-three-way-result<T> operator<=>(reference_wrapper, const T&);                   // Since C++26
+friend constexpr synth-three-way-result<T> operator<=>(reference_wrapper, reference_wrapper<const T>); // Since C++26
----------------
mordante wrote:

Per LWG 4071, note the // Since C++26 is not longer aligned, so please adjust this manually.
```suggestion
friend constexpr auto operator<=>(reference_wrapper, reference_wrapper);          // Since C++26
friend constexpr auto operator<=>(reference_wrapper, const T&);                   // Since C++26
friend constexpr auto operator<=>(reference_wrapper, reference_wrapper<const T>); // Since C++26
```

https://github.com/llvm/llvm-project/pull/88384


More information about the libcxx-commits mailing list