Permuting a typelist
You might have some bug in the algorithm.

"testdata"

struct A {};
struct B {};
struct C {};
struct D {};

using Types = typelist&lt;A, B, C, D&gt;;
using Permutations = typelist&lt;
    typelist&lt;A,B,C,D&gt;,
    typelist&lt;A,B,D,C&gt;,
    typelist&lt;A,C,B,D&gt;,
    typelist&lt;A,C,D,B&gt;,
    typelist&lt;A,D,B,C&gt;,
    typelist&lt;A,D,C,B&gt;,
    typelist&lt;B,A,D,C&gt;,
    typelist&lt;B,A,C,D&gt;,
    typelist&lt;B,C,D,A&gt;,
    typelist&lt;B,C,A,D&gt;,
    typelist&lt;B,D,C,A&gt;,
    typelist&lt;B,D,A,C&gt;,
    typelist&lt;C,A,B,D&gt;,
    typelist&lt;C,A,D,B&gt;,
    typelist&lt;C,B,A,D&gt;,
    typelist&lt;C,B,D,A&gt;,
    typelist&lt;C,D,A,B&gt;,
    typelist&lt;C,D,B,A&gt;,
    typelist&lt;D,A,C,B&gt;,
    typelist&lt;D,A,B,C&gt;,
    typelist&lt;D,B,C,A&gt;,
    typelist&lt;D,B,A,C&gt;,
    typelist&lt;D,C,B,A&gt;,
    typelist&lt;D,C,A,B&gt;
&gt;;
static_assert(std::is_same&lt;permute_t&lt;Types&gt;, Permutations&gt;{}, "!");


results in:

prog.cpp:90:1: error: static assertion failed: !
 static_assert(std::is_same&lt;permute_t&lt;Types&gt;, Permutations&gt;{}, "!");
 ^