[libcxx-commits] [PATCH] D124079: [libc++] Implement ranges::find_end, ranges::search{, _n}

Hui via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 26 17:02:18 PDT 2022


huixie90 requested changes to this revision.
huixie90 added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/include/__algorithm/ranges_find_end.h:54-55
+        __proj2,
+        typename iterator_traits<_Iter1>::iterator_concept(),
+        typename iterator_traits<_Iter2>::iterator_concept());
+    return {__ret.first, __ret.second};
----------------
This looks a bug to me.

In general iterator_traits<_Iter1>::iterator_concept() doesn't exist. (this probably indicates lack of tests in this change)
There is a util in the spec `ITER_CONCEPT` https://eel.is/c++draft/iterator.concepts.general
but that is not even meant to use for checking the exact concept. It is only meant to be used as part of the real iterator concepts together with all syntactic constraints. Note the default is `std::random_access_iterator_tag`

In general, for c++20 code, use the real concepts instead of these tags.

https://godbolt.org/z/3b4hGo8h7


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124079/new/

https://reviews.llvm.org/D124079



More information about the libcxx-commits mailing list