// using aliases for cleaner syntax
template<class T> using Invoke = typename T::type;
template<unsigned...> struct seq{ using type = seq; };
template<class S1, class S2> struct concat;
template<unsigned... I1, unsigned... I2>
struct concat<seq<I1...>, seq<I2...>>
: seq<I1..., (sizeof...(I1)+I2)...>{};
template<class S1, class S2>
using Concat = Invoke<concat<S1, S2>>;
template<unsigned N> struct gen_seq;
template<unsigned N> using GenSeq = Invoke<gen_seq<N>>;
template<unsigned N>
struct gen_seq : Concat<GenSeq<N/2>, GenSeq<N - N/2>>{};
template<> struct gen_seq<0> : seq<>{};
template<> struct gen_seq<1> : seq<0>{};
// example
template<unsigned... Is>
void f(seq<Is...>);
int main(){
f(gen_seq<6>());
}
Ly8gdXNpbmcgYWxpYXNlcyBmb3IgY2xlYW5lciBzeW50YXgKdGVtcGxhdGU8Y2xhc3MgVD4gdXNpbmcgSW52b2tlID0gdHlwZW5hbWUgVDo6dHlwZTsKCnRlbXBsYXRlPHVuc2lnbmVkLi4uPiBzdHJ1Y3Qgc2VxeyB1c2luZyB0eXBlID0gc2VxOyB9OwoKdGVtcGxhdGU8Y2xhc3MgUzEsIGNsYXNzIFMyPiBzdHJ1Y3QgY29uY2F0OwoKdGVtcGxhdGU8dW5zaWduZWQuLi4gSTEsIHVuc2lnbmVkLi4uIEkyPgpzdHJ1Y3QgY29uY2F0PHNlcTxJMS4uLj4sIHNlcTxJMi4uLj4+CiAgOiBzZXE8STEuLi4sIChzaXplb2YuLi4oSTEpK0kyKS4uLj57fTsKICAKdGVtcGxhdGU8Y2xhc3MgUzEsIGNsYXNzIFMyPgp1c2luZyBDb25jYXQgPSBJbnZva2U8Y29uY2F0PFMxLCBTMj4+OwoKdGVtcGxhdGU8dW5zaWduZWQgTj4gc3RydWN0IGdlbl9zZXE7CnRlbXBsYXRlPHVuc2lnbmVkIE4+IHVzaW5nIEdlblNlcSA9IEludm9rZTxnZW5fc2VxPE4+PjsKCnRlbXBsYXRlPHVuc2lnbmVkIE4+CnN0cnVjdCBnZW5fc2Vx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