[libcxx-commits] [PATCH] D107671: [libcxx][ranges] Add `ranges::join_view`.
Tim Song via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 12 17:57:35 PDT 2021
tcanens added inline comments.
================
Comment at: libcxx/include/__ranges/join_view.h:41
+ requires is_reference_v<_Tp>
+ struct __inner_cache<_Tp> { };
+
----------------
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).
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