1 2 3 4 5 6 7 8 9 10 11 12 13
|
Prepending or appending a type to a tt(TypeList) is easy and doesn't require
recursive template meta programs. Two variadic template structs tt(Append) and
tt(Prefix) and two specializations are all it takes.
Here are the declarations of the two variadic template structs:
verbinclude(//STRUCTS examples/append.h)
To append or prefix a new type to a typelist, specializations expect a
typelist and a type to add. Then, they simply define a new tt(TypeList) also
including the new type. The tt(Append) specialization shows that a template
pack does not have to be used as the first argument when defining another
variadic template type:
verbinclude(//ADDTYPE examples/append.h)
|