diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp index c928698e45301..f710ca2c319dd 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp @@ -19,6 +19,7 @@ // constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23 #include +#include #include #include #include @@ -89,8 +90,8 @@ constexpr void test_iterators() { } { // check that an empty range works - ValueT a[] = {}; - auto whole = std::ranges::subrange(Iter(a), Sent(Iter(a))); + std::array a = {}; + auto whole = std::ranges::subrange(Iter(a.data()), Sent(Iter(a.data()))); { bool ret = std::ranges::contains(whole.begin(), whole.end(), 1); assert(!ret); @@ -164,7 +165,7 @@ constexpr bool test() { }); }); - { // count invocations of the projection for continuous iterators + { // count invocations of the projection for contiguous iterators int a[] = {1, 9, 0, 13, 25}; int projection_count = 0; { @@ -215,22 +216,22 @@ constexpr bool test() { } } - { // check invocations of the projection for non-continuous iterators + { // check invocations of the projection for non-contiguous iterators std::vector whole{false, false, true, false}; int projection_count = 0; { - bool ret = std::ranges::contains(whole.begin(), whole.end(), true, [&](int i) { + bool ret = std::ranges::contains(whole.begin(), whole.end(), true, [&](bool b) { ++projection_count; - return i; + return b; }); assert(ret); assert(projection_count == 3); projection_count = 0; } { - bool ret = std::ranges::contains(whole, true, [&](int i) { + bool ret = std::ranges::contains(whole, true, [&](bool b) { ++projection_count; - return i; + return b; }); assert(ret); assert(projection_count == 3);