[libcxx-commits] [libcxx] [libc++][ranges] Fix `ranges::join_view` segmented iterator trait (PR #158347)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 19 01:08:58 PDT 2025


================
@@ -255,7 +255,18 @@ struct join_view<_View>::__iterator final : public __join_view_iterator_category
 
   _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
     requires forward_range<_Base>
-      : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
+      : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {
+    auto __get_inner_range = [&]() -> decltype(auto) {
+      if constexpr (__ref_is_glvalue)
+        return *__get_outer();
+      else
+        return *__parent_->__inner_;
+    };
+    if (__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
+      ++__get_outer();
+      __satisfy();
+    }
+  }
----------------
lbonn wrote:

Updated

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


More information about the libcxx-commits mailing list