[libcxx-commits] [libcxx] [libc++] Optimize {std, ranges}::for_each for iterating over __trees (PR #164405)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 2 08:10:16 PST 2025


================
@@ -715,8 +765,27 @@ private:
   friend class __tree;
   template <class, class, class>
   friend class __tree_const_iterator;
+
+  template <class _NodeIter, class _Func, class _Proj>
+  friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
 };
 
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Tp, class _NodePtr, class _DiffType>
----------------
ldionne wrote:

We need to add a comment explaining that this handles `std::set::iterator` and `std::multiset::iterator` in addition to `__tree::iterator`, since that's not obvious.

Same below for `const_iterator`.

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


More information about the libcxx-commits mailing list