How to obtain the first n elements of a parameter pack? Or the last n elements, or a slice of elements in [n, n+1, ..., m) in general? For instance:
head<3>(1, 2.0f, "three", '4') => make_tuple(1, 2.0f, "three")
tail<2>(1, 2.0f, "three", '4') => make_tuple("three", '4')
slice<1,3>(1, 2.0f, "three", '4') => make_tuple(2.0, "three")
This is doable with a combination of std::tuple, std::integer_sequence and std::get but I was wondering whether there are simpler ways.
First is rather trivial, last is a little more tricky given unpacking rules. You can use rhr to make it more efficient.