Callable object splitting a product type into two.
Split a product type in two product_type containing all the elements before and after a given index. On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.
- Note
- This function will issue a compile time error if I0 is not in [0, sizeof...(Ts)[.
#include <kumi/algorithm/extract.hpp>
template<product_type T, std::size_t I0>
constexpr split_t split
Callable object splitting a product type into two.
Definition extract.hpp:259
Integral constant type.
Definition ct_helpers.hpp:32
- t: Product Type to extract elements from
- i0: Compile-time index of the split pivot
- A new tuple containing the two sub parts of t cut at i0
template<kumi::concepts::product_type T, std::
size_t I0>
struct split
{
using type =
decltype(
kumi::split(std::declval<T>(), kumi::index_t<I0>{}));
};
template<kumi::concepts::product_type T, std::size_t I0> using split_t = typename kumi::result::split<T, I0>::type;
Computes the return type of a call to kumi::split
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
std::cout << a << "\n";
std::cout << first << "\n";
std::cout << second << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
kumi::record a = {
"a"_id = 1,
"b"_id = 2.3,
"c"_id = 4.5f,
"d"_id =
'6',
"e"_id = "7", "f"_id = short{89} };
std::cout << a << "\n";
std::cout << first << "\n";
std::cout << second << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36