[libcxx-commits] [PATCH] D107671: [libcxx][ranges] Add `ranges::join_view`.
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 13 09:24:32 PDT 2021
zoecarver marked an inline comment as done.
zoecarver added inline comments.
================
Comment at: libcxx/include/__ranges/join_view.h:41
+ requires is_reference_v<_Tp>
+ struct __inner_cache<_Tp> { };
+
----------------
tcanens wrote:
> zoecarver wrote:
> > I know you wanted me to do
> > ```
> > static constexpr bool _UseCache = !is_reference_v<_InnerRange>;
> > using _Cache = _If<_UseCache, __non_propagating_cache<remove_cv_t<_InnerRange>>, __empty_cache>;
> > [[no_unique_address]] _Cache __cache_;
> > ```
> > which I agree would be better, but I was getting compiler errors, because `__non_propagating_cache<remove_cv_t<_InnerRange>>` is not valid when `_InnerRange` is a reference type (because `__non_propagating_cache ` requires `is_object_v`).
> >
> > There may be a creative solution to work around this.
> Just use `remove_cvref_t`? If it's not a reference, the `ref` part has no effect. If it is, then we don't care what it ends up being anyway (but it is an object type so it satisfies the constraint).
A simple solution that solves this nicely. Thanks, Tim.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107671/new/
https://reviews.llvm.org/D107671
More information about the libcxx-commits
mailing list