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

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 18 02:15:11 PDT 2024


================
@@ -64,6 +67,46 @@ class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> {
   {
     return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
   }
+
+#if _LIBCPP_STD_VER >= 26
+
+  // [refwrap.comparisons], comparisons
+
+  friend constexpr bool operator==(reference_wrapper __x, reference_wrapper __y) {
+    static_assert(is_convertible_v<decltype(__x.get() == __y.get()), bool>);
----------------
frederick-vs-ja wrote:

The `static_assert` (ditto below) seems reflecting the design in [P2944R2](https://wg21.link/p2944r2). It should be changed to `requires`,

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


More information about the libcxx-commits mailing list