[libcxx-commits] [PATCH] D150831: [libc++] Implement ranges::ends_with
Zijun Zhao via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 31 22:35:26 PDT 2023
ZijunZhao marked an inline comment as done.
ZijunZhao added inline comments.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.ends_with/ranges.ends_with.pass.cpp:255
+ // This is to test (forward_iterator<_Iter1> || sized_sentinel_for<_Sent1, _Iter1>) condition.
+ types::for_each(types::cpp20_input_iterator_list<int*>{}, []<class Iter2>() {
+ types::for_each(types::cpp20_input_iterator_list<int*>{}, []<class Iter1>() {
----------------
var-const wrote:
> I think this should be `random_access_iterator` list, otherwise none of the iterator types in the list are a forward iterator so the `if constexpr (std::forward_iterator...)` below will never be taken.
I think `cpp20_input_iterator_list` already `contains random_access_iterator`?
Why I think so is because from `libcxx/test/support/test_iterators.h`
```
using random_access_iterator_list =
type_list<Ptr,
#if TEST_STD_VER >= 20
contiguous_iterator<Ptr>,
#endif
random_access_iterator<Ptr> >;
template <class Ptr>
using bidirectional_iterator_list =
concatenate_t<random_access_iterator_list<Ptr>, type_list<bidirectional_iterator<Ptr> > >;
template <class Ptr>
using forward_iterator_list = concatenate_t<bidirectional_iterator_list<Ptr>, type_list<forward_iterator<Ptr> > >;
template <class Ptr>
using cpp17_input_iterator_list = concatenate_t<forward_iterator_list<Ptr>, type_list<cpp17_input_iterator<Ptr> > >;
#if TEST_STD_VER >= 20
template <class Ptr>
using cpp20_input_iterator_list =
concatenate_t<forward_iterator_list<Ptr>, type_list<cpp20_input_iterator<Ptr>, cpp17_input_iterator<Ptr>>>;
#endif
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150831/new/
https://reviews.llvm.org/D150831
More information about the libcxx-commits
mailing list