KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches

◆ for_each_index

for_each_index_t kumi::for_each_index {}
inlineconstexpr

Callable object applying the Callable object f on each element of a product type and its index.

Note
This function does not take part in overload resolution if f can't be applied to the elements of t and/or ts and an integral constant. This function cannot be applied on record types.

Header file

#include <kumi/algorithm/for_each.hpp>

Call Signature

template<typename Function, product_type T, product_type... Ts>
constexpr decltype(auto) for_each_index(Function && f, T && t, Ts &&... ts);
constexpr for_each_index_t for_each_index
Callable object applying the Callable object f on each element of a product type and its index.
Definition for_each.hpp:177

Parameters

  • f: Callable object to be invoked
  • t: Product Type whose elements are used as arguments to f
  • ts: Other product types whose elements are used as arguments to f
See also
kumi::for_each
kumi::for_each_field

Examples

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto t = kumi::tuple{ 1ULL, 2.3, 0.43f };
kumi::for_each_index( [](auto i, auto& m) { m += (i+1)*10; }
, t
);
std::cout << t << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:35