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

◆ transpose()

template<concepts::product_type T>
auto kumi::transpose ( T && t)
inlinenodiscardconstexpr

Transpose a product type of product types by shifting elements in their transposed position always returning a tuple as the external product type.

Parameters
tProduct type to transpose
Returns
A product type containing the transposed elements of t.
Note
This function will issue a compile time error if the each element of the input product type are not themselves product types or if their size are not equal.

Helper type

namespace kumi::result
{
template<product_type T> struct transpose;
template<product_type T>
using transpose_t = typename transpose<T>::type;
}
constexpr auto transpose(T &&t)
Transpose a product type of product types by shifting elements in their transposed position always re...
Definition transpose.hpp:44

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

Examples:

Tuple:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto values = kumi::tuple { kumi::tuple{ 1, 'a', 0.1 }
, kumi::tuple{ 2, 'b', 0.01 }
};
auto r = kumi::transpose( values );
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 values = kumi::record{ "first"_id = kumi::record{"a"_id=1, "b"_id='a', "c"_id=0.1 }
, "second"_id = kumi::record{"d"_id=2, "e"_id='b', "f"_id=0.01 }
};
auto r = kumi::transpose( values );
std::cout << r << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36