[libcxx-commits] [libcxx] [libc++] Implement `ranges::fold_left_first` and `ranges::fold_left_first_with_iter` (PR #180214)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 16 12:47:54 PDT 2026


================
@@ -126,6 +130,63 @@ struct __fold_left {
 };
 
 inline constexpr auto fold_left = __fold_left();
+
+struct __fold_left_first_with_iter {
+  template <input_iterator _Iter,
+            sentinel_for<_Iter> _Sent,
+            __indirectly_binary_left_foldable<iter_value_t<_Iter>, _Iter> _Func>
+    requires constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>>
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sent __last, _Func __func) {
----------------
H-G-Hristov wrote:

`[[nodiscard]]` should be tested.

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


More information about the libcxx-commits mailing list