On Sunday, 24 November 2013 at 19:42:21 UTC, Philippe Sigaud wrote:
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.

However, the current set of tools is a bit lacking in that department. Hopefully I'll be able to rectify this with my attempt at a proper std.meta package :) Unfortunately, it's proving to a bit of a stress-test on some dustier parts of the compiler (not to mention my brain), so progress is a bit slower than I would have hoped.

Reply via email to