more typelists & templates
My co-worker Aaron was quick to reply to my earlier post on templates in type-lists with this alternative:
You instead add a non-templated function invoker object:
template <class a, class b>
typedef typedef factory<a,b>::type type;
Then your typelist has normal types in the list, but those types happen to be template metafunctions. To invoke one of these that is in a typelist:
// assuming tlist1 is a typelist
typename tlist1::head::template apply<int, char>::type
(the above ‘template’ and ‘typename’ keywords are, as always, only required or even allowd when used inside a template)
Which in this case will end up naming the type ‘MyType<int, char>’ for you.
This also works. However in my case since I was trying to reduce the number of generated types, so I stuck with the previous solution.