Closed
Description
llvm-project/libcxx/include/__algorithm/ranges_contains_subrange.h
Lines 72 to 80 in c335acc
...because it is based on the C++17 iterator model rather than the C++20 Ranges iterator model.
In addition, __n2
is an integer type and may not accommodate difference_type
.
I believe the above can be just simplified to:
if (ranges::distance(__range2) == 0)
return true;
testcase:
#include <ranges>
#include <algorithm>
static_assert(
std::ranges::contains_subrange(
std::views::iota(0, 5),
std::views::iota(0, 5) | std::views::filter([](int i) { return true; }) )
);