Let's says I have a type
template<typename ...Ts>
struct typelist {};
I need to get a sublist from this list :
template<int startInclusive, int stopExclusive, typename ...Ts>
struct sublist {
using type = ?; //
};
for example
sublist<1, 3, int, float, double, char>::type == typelist<float, double>
When start = 0 I have a working tail implementation :
template<typename ...Ts>
struct typelist {};
template<int N, typename T, typename ...Ts>
struct tail {
using type = typename tail<N - 1, Ts...>::type;
};
template<typename T, typename ...Ts>
struct tail<0, T, Ts...> {
using type = typelist<T, Ts...>;
};
using T = tail<1, int, double>::type;
#include <typeinfo>
#include <cstdio>
int main() {
::printf("%s\n", typeid(T).name());
}
However, I cannot get anything working for start > 0
It's likely to be an overkill, but it works: