3#ifndef TETL_NUMERIC_REDUCE_HPP
4#define TETL_NUMERIC_REDUCE_HPP
6#include <etl/_functional/plus.hpp>
7#include <etl/_iterator/iterator_traits.hpp>
8#include <etl/_numeric/accumulate.hpp>
9#include <etl/_utility/move.hpp>
16template <
typename InputIter,
typename T,
typename BinaryOp>
17[[nodiscard]]
constexpr auto reduce(InputIter first, InputIter last, T init, BinaryOp op) -> T
19 return accumulate(first, last, init, op);
25template <
typename InputIter,
typename T>
26[[nodiscard]]
constexpr auto reduce(InputIter first, InputIter last, T init) -> T
28 return reduce(first, last, init,
etl::
plus<>());
34template <
typename InputIter>
35[[nodiscard]]
constexpr auto reduce(InputIter first, InputIter last) ->
39 return reduce(first, last, init);
constexpr auto reduce(InputIter first, InputIter last, T init) -> T
Similar to etl::accumulate.
Definition reduce.hpp:26
constexpr auto reduce(InputIter first, InputIter last) -> typename etl::iterator_traits< InputIter >::value_type
Similar to etl::accumulate.
Definition reduce.hpp:35
constexpr auto reduce(InputIter first, InputIter last, T init, BinaryOp op) -> T
Similar to etl::accumulate.
Definition reduce.hpp:17
Definition adjacent_find.hpp:9
iterator_traits is the type trait class that provides uniform interface to the properties of LegacyIt...
Definition iterator_traits.hpp:48
Function object for performing addition. Effectively calls operator+ on two instances of type T....
Definition plus.hpp:15