[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
================
@@ -0,0 +1,181 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// <functional>
+
+// class reference_wrapper
+
+// // [refwrap.comparisons], comparisons
+
+// 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
+
+#include <cassert>
+#include <concepts>
+#include <functional>
+
+#include "test_comparisons.h"
+#include "test_macros.h"
+
+struct NonComparable {};
+
+static_assert(!std::three_way_comparable<NonComparable>);
+
+// Test SFINAE.
+
+template <class _Tp>
+concept BooleanTestableImpl = std::convertible_to<_Tp, bool>;
+
+template <class _Tp>
+concept BooleanTestable = BooleanTestableImpl<_Tp> && requires(_Tp&& __t) {
+ { !std::forward<_Tp>(__t) } -> BooleanTestableImpl;
+};
----------------
mordante wrote:
Don't uglify the names on the tests.
https://github.com/llvm/llvm-project/pull/88384
More information about the libcxx-commits
mailing list