Let us suppose that a std::tuple
is given. I would like to create a new std::tuple
whose types are the ones indexed in [
Subrange from tuple with boundary checking, without declaring "helper classes":
template ())>
struct sub_range;
template
struct sub_range, std::index_sequence>
{
static_assert(elems <= sizeof...(args) - starting, "sub range is out of bounds!");
using tuple = std::tuple> ...>;
};
Usage:
struct a0;
...
struct a8;
using range_outer = std::tuple;
sub_range<2, 3, range_outer>::tuple; //std::tuple