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

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 20 23:59:35 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff b8d0cba14bcfc5c1c2f7a878ad9eaa12b6a590b6 a5651607d0181f09a2f2da436e155c07425760e9 -- libcxx/test/std/utilities/function.objects/refwrap/refwrap.comparissons/compare.three_way.pass.cpp libcxx/test/std/utilities/function.objects/refwrap/refwrap.comparissons/equal.pass.cpp libcxx/include/__functional/reference_wrapper.h libcxx/include/functional libcxx/include/version libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index 8d73fc8801..744dc5f5f9 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -96,26 +96,28 @@ public:
     return __x.get() == __y.get();
   }
 
-    // `operator<=>`: Checks the constraints of `synth-three-way` as per https://wg21.link/LWG4071 directly
+  // `operator<=>`: Checks the constraints of `synth-three-way` as per https://wg21.link/LWG4071 directly
 
   friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper __y)
-  requires (_Tp t) { {t < t} -> __boolean_testable;} {
-    return std::__synth_three_way(__x.get(), __y.get());
+    requires(_Tp t)
+  {
+    { t < t } -> __boolean_testable;
   }
+  { return std::__synth_three_way(__x.get(), __y.get()); }
 
   friend constexpr auto operator<=>(reference_wrapper __x, const _Tp& __y)
-  requires (_Tp t) { {t < t} -> __boolean_testable; {
-    return std::__synth_three_way(__x.get(), __y);
-  }
-
-  friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper<const _Tp> __y)
-    requires(!is_const_v<_Tp>) && requires (_Tp t) { {t < t} -> __boolean_testable;
+    requires(_Tp t)
   {
-    return std::__synth_three_way(__x.get(), __y.get());
-  }
+    { t < t } -> __boolean_testable;
+    { return std::__synth_three_way(__x.get(), __y); }
+
+    friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper<const _Tp> __y)
+      requires(!is_const_v<_Tp>) && requires(_Tp t) {
+        { t < t } -> __boolean_testable;
+        { return std::__synth_three_way(__x.get(), __y.get()); }
 
 #endif // _LIBCPP_STD_VER >= 26
-};
+      };
 
 #if _LIBCPP_STD_VER >= 17
 template <class _Tp>

``````````

</details>


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


More information about the libcxx-commits mailing list