hpx::ranges::fold_left

hpx::ranges::fold_left#

Defined in header hpx/algorithm.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

See also:

template<typename InIter, typename Sent, typename T, typename F>
auto hpx::ranges::fold_left(InIter first, Sent last, T init, F f)#

Left-folds a range of elements using a binary operator.

Note

Complexity: Exactly N applications of the binary operator, where N = std::distance(first, last).

Template Parameters:
  • InIter – The type of the source begin iterator (deduced). This iterator must meet the requirements of an input iterator.

  • Sent – The type of the source sentinel (deduced). This sentinel type must be a sentinel for InIter.

  • T – The type of the initial value.

  • F – The type of the binary function object.

Parameters:
  • first – Refers to the beginning of the sequence of elements the algorithm will be applied to.

  • last – Refers to the end of the sequence of elements the algorithm will be applied to.

  • init – The initial value for the fold operation.

  • f – Binary function object that will be applied.

Returns:

The result of left-folding the range.

template<typename Rng, typename T, typename F>
auto hpx::ranges::fold_left(Rng &&rng, T init, F f)#

Left-folds a range of elements using a binary operator.

Note

Complexity: Exactly N applications of the binary operator, where N = std::distance(begin(rng), end(rng)).

Template Parameters:
  • Rng – The type of the source range (deduced).

  • T – The type of the initial value.

  • F – The type of the binary function object.

Parameters:
  • rng – Refers to the sequence of elements the algorithm will be applied to.

  • init – The initial value for the fold operation.

  • f – Binary function object that will be applied.

Returns:

The result of left-folding the range.