[libcxx-commits] [PATCH] D116894: [libc++] [ranges] Implement P2415R2 owning_view

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 12 06:54:15 PST 2022


Quuxplusone marked 5 inline comments as done.
Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/ranges/range.req/range.refinements/viewable_range.compile.pass.cpp:120
 static_assert(!std::ranges::viewable_range<void>);
 static_assert(!std::ranges::viewable_range<int>);
 static_assert(!std::ranges::viewable_range<int (*)(char)>);
----------------
ldionne wrote:
> In the paper, they mention this:
> 
> >  Editor's note: `remove_reference_t` rather than `remove_cvref_t` because we need to reject const `vector<int>&&` from being a `viewable_range`
> 
> I don't think we have a test that a `Range const&&` isn't a `viewable_range` -- could we add one? In other words, I'd like a test that fails if you had used `movable<remove_cvref_t<_Tp>>` instead of `movable<remove_reference_t<_Tp>>`.
> 
My understanding is that this test relies on the ["clever" use of `T` to mean `T&&`](https://reviews.llvm.org/D116991#inline-1119810) that I've been railing against all this week for some reason. ;)
So when you see `static_assert(!std::ranges::viewable_range<const T6>);` above, that's basically the `const vector<int>&&` case — it's testing that a (range, non-view, const, rvalue) is not a viewable_range.

However, if you ask me to rewrite all the above `<X>`s to `<X&&>`s, or to add `<X&&>`s in addition to the `<X>`s, I'll be reasonably happy to do so!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116894



More information about the libcxx-commits mailing list