Invoke the Callable object f with a tuple of arguments.
- Parameters
-
f | Callable object to be invoked |
t | kumi::product_type whose elements to be used as arguments to f |
- Returns
- The value returned by f.
Helper type
namespace kumi::result
{
template<
typename Function, product_type Tuple>
struct apply;
template<typename Function, product_type Tuple>
using apply_t = typename apply<Function,Tuple>::type;
}
Computes the return type of a call to kumi::apply
Example
#include <kumi/tuple.hpp>
#include <iostream>
template<kumi::product_type Tuple>
void print(std::ostream& os, Tuple const& t)
{
(
[&os](auto const&... args)
{
os << '[';
std::size_t n{0};
os << ']';
}, t
);
os << '\n';
}
int main()
{
std::cout <<
kumi::apply( [](
auto... m) {
return (m + ...); }, t) <<
"\n";
print(std::cout, t);
}
Computes the number of elements of a kumi::product_type.
Definition: traits.hpp:45
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35