folly::coro::accumulate

accumulate overloads

Synopses

Declared in <folly/coro/Accumulate.h>

Accumulate the values from an input stream into a single value, similar to std::accumulate.

template<
    typename Reference,
    typename Value,
    typename Output>
Task<Output>
accumulate(
    AsyncGenerator<Reference, Value> generator,
    Output init);
» more...

Accumulate the values from an input stream using a binary operation.

template<
    typename Reference,
    typename Value,
    typename Output,
    typename BinaryOp>
Task<Output>
accumulate(
    AsyncGenerator<Reference, Value> generator,
    Output init,
    BinaryOp op);
» more...

Return Value

A Task containing the result of the accumulation.

Parameters

NameDescription
generatorThe input stream of values.
initThe initial value of the accumulation.
opThe binary operation combining the accumulator and each value.