On Sun, Nov 24, 2013 at 6:40 PM, Shammah Chancellor
<anonym...@coward.com> wrote:


> However, for non-string templates.   They have to be written in a recursive
> form, which can be particularly difficult in some cases.
>
>         template FooTemplate()  //This code is totally made up and not meant
> to do anything useful, or necessarily be valid.
>         {
>                 auto FooTemplate = TypeTuple!()
>                 static foreach(member, __traits( allMembers, someClass)
>                 {
>                         FooTemplate = TypeTuple!(FooTemplate,
> __traits(getMember, someClass, member));
>                 }
>         }
>
> What's the consensis on something like this?

The consensus might well be 'use recursion' :) That's what I'd do in
your case. CT computation on types is a lot like functional
programming: recursion and immutability.

Another solution would be to construct you type as a string, and then mix it in.

Reply via email to