Loading [MathJax]/extensions/tex2jax.js
kumi v3.1.0
Exquisite Epidote
 
All Classes Namespaces Functions Variables Friends Modules Pages Concepts
Loading...
Searching...
No Matches

◆ zip()

template<product_type T0, sized_product_type< size_v< T0 > >... Ts>
constexpr auto kumi::zip ( T0 const t0,
Ts const &...  ts 
)
constexpr

Constructs a tuple where the ith element is the tuple of all ith elements of ts...

Parameters
t0Tuple to convert
tsTuples to convert
Returns
The tuple of all combination of elements from t0, ts...

Helper type

namespace kumi::result
{
template<product_type Tuple> struct zip;
template<product_type Tuple>
using zip_t = typename zip<Tuple>::type;
}
constexpr auto zip(T0 const &t0, Ts const &...ts)
Constructs a tuple where the ith element is the tuple of all ith elements of ts...
Definition zip.hpp:37

Computes the return type of a call to kumi::zip

Example

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
auto nbrs = kumi::tuple{1,2,3};
auto ltrs = kumi::tuple{'a','b','c'};
auto ratio = kumi::tuple{0.1,0.01,0.001};
auto r = kumi::zip( nbrs, ltrs, ratio );
std::cout << r << "\n";
}
constexpr auto from_tuple(tuple< Ts... > const &t)
Converts a kumi::tuple to an instance of an arbitrary type.
Definition convert.hpp:59
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:35