Computes the inclusive prefix scan of all elements of a product type using a tail recursive call.
- Note
- The first stored value is the result of the application of the monoid to it's identity and the first element of the product_type.
- Parameters
-
| m | Monoid callable function to apply |
| t | Product type to operate on |
- Returns
- A tuple of prefix partial accumulations where each element 'I' equals m( m( m(init, get<0>(t)), ...), get<I-1>(t))
Helper type
namespace kumi::result
{
template<typename Function, product_type Tuple>
}
constexpr auto inclusive_scan_left(Function f, T &&t, Value init)
Computes the inclusive prefix scan of all elements of a product type using a tail recursive call.
Definition scan.hpp:69
Computes the return type of a call to kumi::inclusive_scan_left
Examples:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
{
return acc + sizeof(elt);
}
, t
, std::size_t{42}
);
std::cout << output << "\n";
}
constexpr numeric_add plus
Forms a binary monoid callable that can be used in kumi::algoritm. It represents the addition.
Definition monoid.hpp:124
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto r =
kumi::record{
"a"_id = 2.,
"b"_id = 1,
"c"_id =
short{55},
"d"_id =
'z'};
{
return acc + sizeof(elt);
}
, r
, std::size_t{42}
);
std::cout << output << "\n";
auto u =
kumi::record{
"a"_id = 1,
"b"_id = 3,
"c"_id = 2,
"d"_id = 4,
"e"_id = 0
,"f"_id = 5,"g"_id = 9,"h"_id = 6,"i"_id = 7};
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29