Extracts a sub-tuple from a product type.
- Note
- Does not participate in overload resolution if I0 and I1 do not verify that 0 <= I0 <= I1 <= size_v<T>.
- Parameters
-
| t | Tuple to extract from |
| i0 | Compile-time index of the first element to extract. |
| i1 | Compile-time index past the last element to extract. By default, i1 is equal to size_v<T>. |
- Returns
- A new kumi::tuple containing to the selected elements of the input tuple.
Helper type
namespace kumi::result
{
template<product_type Tuple, std::size_t I0, std::size_t I1=-1>
struct extract;
template<product_type Tuple, std::size_t I0, std::size_t I1=-1>
}
constexpr auto extract(Tuple &&t, index_t< I0 > i0, index_t< I1 > i1) noexcept
Extracts a sub-tuple from a product type.
Definition extract.hpp:43
Computes the type returned by a call to extract.
Examples:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
std::cout << a << " => " << head << ' ' << mid << ' ' << last << '\n';
}
constexpr index_t< N > const index
Inline integral constant value for kumi::index_t.
Definition ct_helpers.hpp:67
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#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 << " => " << head << ' ' << mid << ' ' << last << '\n';
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29