View source code
Display the source code in std/algorithm/iteration.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

std.algorithm.iteration.cumulativeFold.cumulativeFold - multiple declarations

Function cumulativeFold.cumulativeFold

No-seed version. The first element of r is used as the seed's value. For each function f in fun, the corresponding seed type S is Unqual!(typeof(f(e, e))), where e is an element of r: ElementType!R. Once S has been determined, then S s = e; and s = f(s, e); must both be legal.

auto auto cumulativeFold(R) (
  R range
)
if (isInputRange!(Unqual!R));

Parameters

NameDescription
range An input range

Returns

a range containing the consecutive reduced values.

Function cumulativeFold.cumulativeFold

Seed version. The seed should be a single value if fun is a single function. If fun is multiple functions, then seed should be a Tuple, with one field per function in f. For convenience, if the seed is const, or has qualified fields, then cumulativeFold will operate on an unqualified copy. If this happens then the returned type will not perfectly match S.

auto auto cumulativeFold(R, S) (
  R range,
  S seed
)
if (isInputRange!(Unqual!R));

Parameters

NameDescription
range An input range
seed the initial value of the accumulator

Returns

a range containing the consecutive reduced values.

Authors

Andrei Alexandrescu

License

Boost License 1.0.