I tried to implement the C++14 alias template make_integer_sequence
, which simplifies the creation of the class template integer_sequence.
templ
Here's a log N
implementation that doesn't even need an increased max-depth for template instantiations and compiles pretty fast:
// using aliases for cleaner syntax
template using Invoke = typename T::type;
template struct seq{ using type = seq; };
template struct concat;
template
struct concat, seq>
: seq{};
template
using Concat = Invoke>;
template struct gen_seq;
template using GenSeq = Invoke>;
template
struct gen_seq : Concat, GenSeq>{};
template<> struct gen_seq<0> : seq<>{};
template<> struct gen_seq<1> : seq<0>{};