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);

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);

Return Value

A Task containing the result of the accumulation.

Parameters

Name

Description

generator

The input stream of values.

init

The initial value of the accumulation.

op

The binary operation combining the accumulator and each value.

Created with MrDocs