[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


================
@@ -234,8 +243,37 @@ namespace ranges {
         __inner_.reset();
     }
 
+    _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
+      if constexpr (forward_range<_Base>) {
+        return __outer_;
+      } else {
+        return *__parent_->__outer_;
+      }
+    }
+
+    _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
+      if constexpr (forward_range<_Base>) {
+        return __outer_;
+      } else {
+        return *__parent_->__outer_;
+      }
+    }
+
+    _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
+      requires forward_range<_Base>
+        : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
+      __satisfy();
+    }
+
+    _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent)
----------------
ldionne wrote:

```suggestion
    _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
```

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


More information about the libcxx-commits mailing list