[libcxx-commits] [PATCH] D115177: [libc++] [ranges] SFINAE-friendly "write it three times" in views::counted.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 6 12:47:09 PST 2021


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, zoecarver, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

Before this patch, the new test's `CountedInvocable<int*, int*>` would hard-error instead of SFINAEing and cleanly returning false.

Notice that views::counted specifically does NOT work with pipes; `counted(42)` is ill-formed. This is because `counted`'s first argument is supposed to be an iterator, not a range.

Also in this PR, drive-by replace some stray `std::` with `_VSTD::`-or-nothing, as appropriate. These will be committed in a separate commit, but I want to poke buildkite about them just to be on the safe side.

The new free function `base(cpp20_input_iterator)` is needed for the new `counted` test; it's just filling out a bit of the test_iterators.h API that was missing originally. It's on my TODO list to move the other test iterators' `base(i)` functions into hidden friends too; I've just been procrastinating and/or rabbit-holing. (See D111372 <https://reviews.llvm.org/D111372>, which got most of the way down the rabbit hole and then I went off to do other things and haven't come back yet.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115177

Files:
  libcxx/include/__compare/strong_order.h
  libcxx/include/__compare/weak_order.h
  libcxx/include/__ranges/counted.h
  libcxx/include/__ranges/subrange.h
  libcxx/test/std/ranges/range.adaptors/range.counted/counted.pass.cpp
  libcxx/test/support/test_iterators.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115177.392152.patch
Type: text/x-patch
Size: 23808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211206/4070c9ba/attachment-0001.bin>


More information about the libcxx-commits mailing list