[libcxx-commits] [libcxx] [libc++] Implement `ranges::fold_right` (PR #193997)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 29 20:17:56 PDT 2026


================
@@ -23,6 +23,7 @@
 #include <__iterator/concepts.h>
 #include <__iterator/iterator_traits.h>
 #include <__iterator/next.h>
+#include <__iterator/reverse_iterator.h>
----------------
frederick-vs-ja wrote:

I'm a bit hesitant about dragging `reverse_iterator` in. Can we introduce a `backward` version of `__for_each` and just use it?

Note that there's already `__for_each_segment_backward`.
https://github.com/llvm/llvm-project/blob/8d53d36cf314279e5a463a4806e2babe37fb67ee/libcxx/include/__algorithm/for_each_segment.h#L51-L53

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


More information about the libcxx-commits mailing list