[libcxx-commits] [libcxx] [libc++][NFC] Centralize test for support of == and != in ranges (PR #78481)
Will Hawkins via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 28 10:42:31 PDT 2024
================
@@ -70,37 +70,33 @@ struct LessThan3 {
constexpr bool operator()(int i) const { return i < 3; }
};
-// Test Constraint
-template <class I, class S>
-concept HasEqual = requires(const I i, const S s) { i == s; };
-
using std::ranges::iterator_t;
using std::ranges::sentinel_t;
using std::ranges::take_while_view;
-static_assert(HasEqual<iterator_t<take_while_view<R, LessThan3>>, //
- sentinel_t<take_while_view<R, LessThan3>>>);
+static_assert(weakly_equality_comparable_with<iterator_t<take_while_view<R, LessThan3>>, //
+ sentinel_t<take_while_view<R, LessThan3>>>);
-static_assert(!HasEqual<iterator_t<const take_while_view<R, LessThan3>>, //
- sentinel_t<take_while_view<R, LessThan3>>>);
+static_assert(!weakly_equality_comparable_with<iterator_t<const take_while_view<R, LessThan3>>, //
+ sentinel_t<take_while_view<R, LessThan3>>>);
-static_assert(!HasEqual<iterator_t<take_while_view<R, LessThan3>>, //
- sentinel_t<const take_while_view<R, LessThan3>>>);
+static_assert(!weakly_equality_comparable_with<iterator_t<take_while_view<R, LessThan3>>, //
+ sentinel_t<const take_while_view<R, LessThan3>>>);
-static_assert(HasEqual<iterator_t<const take_while_view<R, LessThan3>>, //
- sentinel_t<const take_while_view<R, LessThan3>>>);
+static_assert(weakly_equality_comparable_with<iterator_t<const take_while_view<R, LessThan3>>, //
+ sentinel_t<const take_while_view<R, LessThan3>>>);
-static_assert(HasEqual<iterator_t<take_while_view<R, LessThan3>>, //
- sentinel_t<take_while_view<R, LessThan3>>>);
+static_assert(weakly_equality_comparable_with<iterator_t<take_while_view<R, LessThan3>>, //
----------------
hawkinsw wrote:
Thank you! I appreciate that feedback! I wasn't sure how most reviewers do subsequent reviews.
https://github.com/llvm/llvm-project/pull/78481
More information about the libcxx-commits
mailing list