[libcxx-commits] [PATCH] D136268: [libc++][ranges] implement `std::views::elements_view`

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 12 12:41:07 PST 2022


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

Thanks a lot for working on this! Once this lands, we will only have `split_view` between our current state and a full C++20 implementation of Ranges.

I can do a follow-up to mark some papers and LWG issues that are complete now that `elements_view` is implemented (there are quite a few!). Feel free to ignore my comments re. papers and issues.



================
Comment at: libcxx/test/std/ranges/range.adaptors/range.elements/iterator/arithmetic.pass.cpp:52
+static_assert(std::ranges::random_access_range<RandomAccessRange>);
+static_assert(std::sized_sentinel_for<std::ranges::iterator_t<RandomAccessRange>, //
+                                      std::ranges::iterator_t<RandomAccessRange>>);
----------------
huixie90 wrote:
> var-const wrote:
> > Question: is the empty comment to enforce a certain formatting?
> Yes. if you have strong feelings I can remove them and put
> ```
> // clang-format off
> // clang-format on
> ```
> around them
No strong feelings, just making sure it's deliberate.


================
Comment at: libcxx/test/std/ranges/range.adaptors/range.elements/iterator/base.pass.cpp:53
+    decltype(auto) base = it.base();
+    static_assert(std::is_same_v<decltype(base), std::tuple<int>* const&>);
+    assert(base == &t);
----------------
huixie90 wrote:
> var-const wrote:
> > Question: why not use `std::same_as<> decltype(auto)` on the previous line instead?
> as of the patch was written (about 2-3 months ago?), Some compilers in the CI which were based on older version of clang has a bug where `std::same_as<Foo&> decltype(auto) = ...` does not work if the return type is a reference
Ah, in that case, let's keep as is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136268



More information about the libcxx-commits mailing list