
Discover more from Daily bit(e) of C++
Random C++ knowledge organized in arbitrary order.
Over 1,000 subscribers
Already have an account? Sign in
Daily bit(e) of C++ | std::accumulate, std::partial_sum
Daily bit(e) of C++ #291, The two single-range left-fold algorithms: std::accumulate and std::partial_sum.
std::accumulate and std::partial_sum are single-range left-fold algorithms.
Both algorithms operate strictly left-to-right, std::accumulate producing a single value, std::partial_sum emitting all partial results.
Due to the left-to-right operation, these algorithms are less performant than generalized reductions but permit reduction operations with side effects and state.