KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ transpose

transpose_t kumi::transpose {}
inlineconstexprnodiscard

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

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.

Header file

#include <kumi/algorithm/transpose.hpp>

Call Signature

template<product_type T>
constexpr auto transpose(T && t);
constexpr transpose_t transpose
Callable object transposing a product type of product types by shifting elements in their transposed ...
Definition transpose.hpp:92

Parameters

  • t: Product Type to transpose

Return value

  • A product type containing the transposed elements of t.

Helper type

template<kumi::concepts::product_type T> struct transpose
{
using type = decltype(kumi::transpose(std::declval<T>()));
};
template<kumi::concepts::product_type T> using transpose_t = typename kumi::result::transpose<T>::type;

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