Repository navigation
Folding algorithms - #3099
Folding algorithms#3099
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Thanks, this looks great! 😻 I exhaustively compared this to the Standard, and checked all of the |
|
|
||
|
template |
||
| _NODISCARD constexpr auto operator()(_Rng&& _Range, _Ty _Init, _Fn _Func) const { | ||
| return _RANGES fold_left_with_iter(_STD forward<_Rng>(_Range), _STD move(_Init), _Pass_fn(_Func)).value; |
There was a problem hiding this comment.
Ideally we'd want this to avoid the extra move into the in_value_result and back out. (This is why the wording uses Returns: instead of "Effects: Equivalent to return ...;")
There was a problem hiding this comment.
Do RVO or deferred temporary materialization help with that?
I think this would be reasonable to address in a followup PR.
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
I've pushed a merge with |
|
Thanks for implementing this C++23 feature! ⚙️ 🎉 😻 |

This PR implements P2322R6 (
ranges::fold) and closes #2922.Changes:
header includesin C++23 mode,ranges::fold_leftandranges::fold_left_with_iter- both invoke_Fold_left_with_iter_fn::_Fold_left_with_iter_impl,ranges::fold_left_firstandranges::fold_left_first_with_iter- both invoke_Fold_left_first_with_iter_fn::_Fold_left_first_with_iter_impl,ranges::fold_right- invokes_Fold_right_uncheckedranges::fold_right_last- invokes private function_Fold_right_last_unchecked