kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches

◆ for_each()

template<typename Function , product_type Tuple, product_type... Tuples>
requires _::supports_call<Function&, Tuple, Tuples...>
constexpr void kumi::for_each ( Function  f,
Tuple &&  t,
Tuples &&...  ts 
)
constexpr

Applies the Callable object f on each element of a kumi::product_type.

Note
This function does not take part in overload resolution if f can't be applied to the elements of t and/or ts.
Parameters
fCallable object to be invoked
tkumi::product_type whose elements to be used as arguments to f
tsOther kumi::product_type whose elements to be used as arguments to f
See also
kumi::for_each_index

Example

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
auto t = kumi::tuple{ 1, 2.3, 0.43f };
kumi::for_each( [](auto& m) { m *= 10; }
, t
);
std::cout << t << "\n";
}
constexpr void for_each(Function f, Tuple &&t, Tuples &&... ts)
Applies the Callable object f on each element of a kumi::product_type.
Definition: for_each.hpp:30
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35