[libcxx-commits] [PATCH] D144767: [libc++][ranges] Implement P2443R1: `views::chunk_by`

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 17 17:06:24 PDT 2023


var-const accepted this revision.
var-const added a comment.
This revision is now accepted and ready to land.

Thanks for working on this! LGTM (with just one comment), and feel free to ping me if you run into any problems when rebasing.



================
Comment at: libcxx/test/libcxx/ranges/range.adaptors/range.chunk.by/assert.begin.pass.cpp:13
+// XFAIL: availability-verbose_abort-missing
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
+
----------------
Quick tip: when you rebase, you can replace `D_LIBCPP_ENABLE_ASSERTIONS=1` with `// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode`.


================
Comment at: libcxx/test/libcxx/ranges/range.adaptors/range.chunk.by/assert.find-next.pass.cpp:26
+  int input[] = {1, 2, 3};
+  auto view1  = std::views::chunk_by(input, ThrowOnCopyPred{});
+  auto view2  = std::views::chunk_by(input, ThrowOnCopyPred{});
----------------
JMazurkiewicz wrote:
> var-const wrote:
> > Question: is this the only (or easiest) way to get an invalid predicate? Would a default-constructed view work here, perhaps?
> This is the easiest way (I think) to get `__find_next` to fail. If we used default constructed view here, then `begin()` would fail instead of `__find_next`.
Thanks for explaining. I think it deserves a comment in the test file.


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

https://reviews.llvm.org/D144767



More information about the libcxx-commits mailing list