3#ifndef TETL_NUMERIC_TRANSFORM_REDUCE_HPP
4#define TETL_NUMERIC_TRANSFORM_REDUCE_HPP
6#include <etl/_functional/multiplies.hpp>
7#include <etl/_functional/plus.hpp>
13template <
typename InputIt1,
typename InputIt2,
typename T,
typename BinaryReductionOp,
typename BinaryTransformOp>
19 BinaryReductionOp reduce,
20 BinaryTransformOp transform
23 for (; first1 != last1; ++first1, (
void)++first2) {
24 init = reduce(init, transform(*first1, *first2));
31template <
typename InputIt1,
typename InputIt2,
typename T>
32[[nodiscard]]
constexpr auto transform_reduce(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init) -> T
39template <
typename InputIt,
typename T,
typename BinaryReductionOp,
typename UnaryTransformOp>
40[[nodiscard]]
constexpr auto
41transform_reduce(InputIt first, InputIt last, T init, BinaryReductionOp reduce, UnaryTransformOp transform) -> T
43 for (; first != last; ++first) {
44 init = reduce(init, transform(*first));
constexpr auto transform_reduce(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init, BinaryReductionOp reduce, BinaryTransformOp transform) -> T
https://en.cppreference.com/w/cpp/algorithm/transform_reduce
Definition transform_reduce.hpp:14
constexpr auto transform_reduce(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init) -> T
https://en.cppreference.com/w/cpp/algorithm/transform_reduce
Definition transform_reduce.hpp:32
constexpr auto transform_reduce(InputIt first, InputIt last, T init, BinaryReductionOp reduce, UnaryTransformOp transform) -> T
https://en.cppreference.com/w/cpp/algorithm/transform_reduce
Definition transform_reduce.hpp:41
Definition adjacent_find.hpp:9
Function object for performing multiplication. Effectively calls operator* on two instances of type T...
Definition multiplies.hpp:15
Function object for performing addition. Effectively calls operator+ on two instances of type T....
Definition plus.hpp:15