[libcxx-commits] [PATCH] D117714: [libc++] Implement LWG3549: view_interface need not inherit from view_base

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 20 18:13:35 PST 2022


jloser marked an inline comment as done.
jloser added inline comments.


================
Comment at: libcxx/test/std/ranges/range.req/range.view/enable_view.compile.pass.cpp:50-53
+struct V1 : std::ranges::view_interface<V1> {};
+static_assert(std::ranges::enable_view<V1>);
+static_assert(std::ranges::enable_view<const V1>);
+static_assert(std::ranges::enable_view<const V1&>);
----------------
Quuxplusone wrote:
> Let's also test
> ```
> struct V3 : std::ranges::view_interface<V1> {};
> static_assert(std::ranges::enable_view<V3>);
> static_assert(!std::ranges::enable_view<V3&>);
> static_assert(!std::ranges::enable_view<V3&&>);
> static_assert(!std::ranges::enable_view<const V3>);
> static_assert(!std::ranges::enable_view<const V3&>);
> static_assert(!std::ranges::enable_view<const V3&&>);
> ```
> I'm actually confused that `enable_view<const V1>` and `<const V1&>` are true; I don't see any textual support for that in http://eel.is/c++draft/range.view . Can you see why that's happening, and fix it if need be?
> 
> Since our implementation is messing around with pointer conversions, let's also sanity-check that `!enable_view<void>`.
I just wrote a simple implementation to make `enable_view<const V1>` and `enable_view<const V1&>` and friends false. There isn't support for it in the Standard, despite the fact that there is implementation divergence. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117714



More information about the libcxx-commits mailing list