[libcxx-commits] [PATCH] D126610: [libc++] Implement ranges::adjacent_find

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 7 11:58:11 PDT 2022


Mordante accepted this revision.
Mordante added a comment.
This revision is now accepted and ready to land.

LGTM, but one suggested change.



================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.adjacent.find/ranges.adjacent_find.pass.cpp:54
+
+template <int N>
+struct Data {
----------------



================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.adjacent.find/ranges.adjacent_find.pass.cpp:60
+
+template <class Iter, class Sent, int N>
+constexpr void test(Data<N> d) {
----------------



================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.adjacent.find/ranges.adjacent_find.pass.cpp:77
+  // simple test
+  test<Iter, Sent, 4>({.input = {1, 2, 2, 4}, .expected = 1});
+  // last is returned with no match
----------------
philnik wrote:
> Mordante wrote:
> > Can't `N` be deduced?
> I don't think so. @var-const and I also thought it could be deduced, but I couldn't get it to work.
I gave it a shot, but I too failed to get it to work. I would suggest then to change the type to `size_t` to match the type used in `std::array`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126610



More information about the libcxx-commits mailing list