[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)
----------------
ldionne wrote:

Can you please add tests for these constructors? You removed the test in `libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/ctor.parent.outer.pass.cpp` but I don't think you added any for the new ctors. Note that those are exposition only ctors so the tests could go in `libcxx/test/libcxx/<...>` instead of `libcxx/test/std/<...>` -- or if you prefer you can put them in `libcxx/test/std` but mark them with `REQUIRES: stdlib=libc++`.

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


More information about the libcxx-commits mailing list