[llvm] [ADT] Relax iterator constraints on all_equal (PR #106400)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 09:38:00 PDT 2024
================
@@ -831,6 +832,26 @@ TEST(STLExtrasTest, AllEqual) {
EXPECT_FALSE(all_equal(V));
}
+// Test to verify that all_equal works with a container that does not
+// model the random access iterator concept.
+TEST(STLExtrasTest, AllEqualNonRandomAccess) {
+ std::list<int> V;
+ static_assert(!std::is_convertible<std::iterator_traits<decltype(V)::iterator>::iterator_category,
+ std::random_access_iterator_tag >::value);
----------------
kuhar wrote:
```suggestion
static_assert(!std::is_convertible_v<std::iterator_traits<decltype(V)::iterator>::iterator_category,
std::random_access_iterator_tag >);
```
https://github.com/llvm/llvm-project/pull/106400
More information about the llvm-commits
mailing list