[libcxx-commits] [libcxx] [libc++] P2770R0: "Stashing stashing iterators for proper flattening" (PR #66033)
Jakub Mazurkiewicz via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 12 12:32:00 PDT 2023
================
@@ -84,11 +82,16 @@ namespace ranges {
template <class>
friend struct std::__segmented_iterator_traits;
- static constexpr bool _UseCache = !is_reference_v<_InnerRange>;
- using _Cache = _If<_UseCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cache_;
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+ static constexpr bool _UseOuterCache = !forward_range<_View>;
+ using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
+
+ static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
+ using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
----------------
JMazurkiewicz wrote:
I think I'm going to leave it as it is (for now). Other range adaptors (like `drop_while_view`, `filter_view`, `chunk_by_view`) use similar style.
I can address your comment in follow-up PR to clean up style in other adaptors too.
https://github.com/llvm/llvm-project/pull/66033
More information about the libcxx-commits
mailing list