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

◆ flatten()

template<product_type Tuple>
constexpr auto kumi::flatten ( Tuple const &  ts)
constexpr

Converts a tuple of tuples into a tuple of all elements.

Parameters
tsTuple to flatten
Returns
A tuple composed of all elements of t flattened non-recursively

Helper type

namespace kumi::result
{
template<product_type Tuple> struct flatten;
template<product_type Tuple>
using flatten_t = typename flatten<Tuple>::type;
}
constexpr auto flatten(Tuple const &ts)
Converts a tuple of tuples into a tuple of all elements.
Definition: flatten.hpp:35

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

Example

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
auto nbrs = kumi::tuple{1,2,3};
auto more_nbrs = kumi::tuple{0,nbrs,4};
auto ltrs = kumi::tuple{'a','b','c'};
auto r = kumi::flatten( kumi::tuple{3.5,nbrs,'z',more_nbrs,5.35f,ltrs} );
std::cout << r << "\n";
}
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35