Concatenating compile time sequences

Victor Porton porton at narod.ru
Sat Mar 2 02:16:22 UTC 2019


I try to split a compile time sequence of types and names into a 
sequence consisting of two-element subsequences (each of type and 
name).

That is, I want to transform:

(int, "x", float, "y", double, "z")

into

(AliasSeq!(int, "x"), AliasSeq!(float, "y"), AliasSeq!(double, 
"z"))

I am trying like this:

private alias enum processFields() = AliasSeq!();

private alias enum processFields(T, name, Fields...) =
     AliasSeq!(AliasSeq!(T, name), processFields!(Fields));

But the above would (as I understand) make AliasSeq! returned by 
the recursively called processFields an element of the parent 
sequence rather than its tail subsequence as it should.

Please help to fix the above code. I want namely a recursive 
implementation like the above, because I am going to generalize 
it for some more complex cases.


More information about the Digitalmars-d-learn mailing list