template<concepts::product_type T0, concepts::sized_product_type< size_v< T0 > >... Ts>
requires (concepts::follows_same_semantic<T0, Ts...>)
| auto kumi::zip |
( |
T0 && | t0, |
|
|
Ts &&... | ts ) |
|
inlinenodiscardconstexpr |
Constructs a tuple where the ith element is the product type of all ith elements of t0,ts...
On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.
- Note
- This function does not take part in overload resolution if the product types do not follow the same semantic.
- See also
- follows_same_semantic
- Parameters
-
| t0 | Product type to convert |
| ts | Product types to convert |
- Returns
- The tuple of all combination of elements from t0, ts...
Helper type
namespace kumi::result
{
template<product_type T>
struct zip;
template<product_type T>
}
constexpr auto zip(T0 &&t0, Ts &&... ts)
Constructs a tuple where the ith element is the product type of all ith elements of t0,...
Definition zip.hpp:97
Computes the return type of a call to kumi::zip
- See also
- zip_min
-
zip_max
Examples:
Tuple:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
std::cout << r << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33
Record:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto ltrs =
kumi::record{
"d"_id=
'a',
"e"_id=
'b' ,
"f"_id=
'c' };
auto ratio =
kumi::record{
"g"_id=0.1,
"h"_id=0.01,
"i"_id=0.001};
std::cout << r << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36