Apply the Callable object f on each tuples' elements and their indexes.
Applies the given function to all the tuples passed as arguments along with their indexes and stores the result in another tuple, keeping the original elements order.
- Note
- Does not participate in overload resolution if tuples' size are not equal or if
f
can't be called on each tuple's elements and their indexes.
- Parameters
-
f | Callable function to apply |
t0 | Tuple to operate on |
others | Tuples to operate on |
- Returns
- The tuple of
f
calls results.
Helper type
namespace kumi::result
{
using map_index_t = typename map_index<Function,Tuple>::type;
}
Concept specifying a type follows the Product Type semantic.
Definition: concepts.hpp:33
Computes the return type of a call to kumi::map_index
Example
#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
auto r =
kumi::map_index( [](
auto i,
auto l,
auto r) {
return 1000*(i+1)+(l*r); }
, lhs, rhs
);
std::cout << r << "\n";
}
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35