Slightly simpler:

struct SomeType(K, V) {}

alias X(V)       = V;
alias X(V, K...) = SomeType!(K[0], X!(V, K[1 .. $]));




That's a recurring pattern to get used to: aliasing away to one of the parameters in a terminal and/or degenerate case. Also: that an empty tuple matches no parameter "more exactly" than a tuple parameter. I know that's not at all obvious, but it's what I've found to be the case; so when K[1 ..$] above ends up as the empty tuple (that is, when all K have been exhausted), the template for X(V) will be the "more exact match."

Reply via email to