Performs a tree-like reduction of all elements of a product type. The given map function is applied before excution the reduction to each element of the input.
namespace kumi::result
{
template<mono
id M, product_type T,
typename Value>
struct map_reduce;
template<monoid M, product_type T, typename Value>
using map_reduce_t = typename map_reduce<M,T,Value>::type;
}
constexpr auto map_reduce(Function &&f, M &&m, T &&t)
Performs a tree-like reduction of all elements of a product type. The given map function is applied b...
Definition reduce.hpp:150
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto times_two = [&](auto e){ return 2*e; };
auto is_pair = [&](auto e){ return e%2==0; };
}
constexpr numeric_prod multiplies
Forms a binary monoid callable that can be used in kumi::algoritm. It represents the multiplication.
Definition monoid.hpp:136
constexpr numeric_add plus
Forms a binary monoid callable that can be used in kumi::algoritm. It represents the addition.
Definition monoid.hpp:129
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:37