hpx::ranges::fold_left_first

hpx::ranges::fold_left_first#

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 F>
auto hpx::ranges::fold_left_first(InIter first, Sent last, F f)#

Left-folds a range using the first element as the initial value.

Note

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

Template Parameters:
  • InIter – The type of the source begin iterator (deduced).

  • Sent – The type of the source sentinel (deduced).

  • F – The type of the binary function object.

Parameters:
  • first – Refers to the beginning of the sequence.

  • last – Refers to the end of the sequence.

  • f – Binary function object that will be applied.

Returns:

An optional containing the fold result, or std::nullopt if the range is empty.

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

Left-folds a range using the first element as the initial value.

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

  • F – The type of the binary function object.

Parameters:
  • rng – Refers to the sequence of elements.

  • f – Binary function object that will be applied.

Returns:

An optional containing the fold result, or std::nullopt if the range is empty.