[libcxx-commits] [libcxx] [libc++] P2770R0: "Stashing stashing iterators for proper flattening" (PR #66033)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 16 18:15:55 PST 2023


================
@@ -287,14 +317,14 @@ namespace ranges {
 
     _LIBCPP_HIDE_FROM_ABI
     constexpr __iterator& operator++() {
-      auto&& __inner = [&]() -> auto&& {
+      auto __get_inner_range = [&]() -> decltype(auto) {
         if constexpr (__ref_is_glvalue)
-          return *__outer_;
+          return *__get_outer();
         else
-          return *__parent_->__cache_;
-      }();
-      if (++*__inner_ == ranges::end(__inner)) {
-        ++__outer_;
+          return *__parent_->__inner_;
+      };
+      if (++*__inner_ == ranges::end(ranges::__as_lvalue(__get_inner_range()))) {
----------------
ldionne wrote:

```suggestion
      if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
```

Below too.

https://github.com/llvm/llvm-project/pull/66033


More information about the libcxx-commits mailing list