On Thu, Aug 19, 2010 at 21:51, Simen kjaeraas <simen.kja...@gmail.com>wrote:

> Johannes Pfau <s...@example.com> wrote:
>
>  Hi,
>> I want to do exactly the same as described in
>> http://d.puremagic.com/issues/show_bug.cgi?id=4536 . The problem is I
>> can't even get the workaround to work. Dmd complains about the following
>> template:
>> ---------------------------------------------------------------
>> template Init(T...)
>> {
>
>  alias (Tuple!T.init).expand Init;
>> }
>>
>
Hmm, I'm pretty sure it used to worked, because as one time that's what I
used.

Anyway, Simen's solutions is better, a bit less dependency. TypeTuple is a
bit more universal than Tuple.

Simen:

>
> template Init( T ) {
>    alias TypeTuple!( T.init ) Init;
> }
>
> template Init( T, U... ) {
>    alias TypeTuple!( T.init, Init!U ) Init;
> }
>
>
And, looking in my codebase, here is what I'm using ;)

template Init(T...)
{
    T Init;
}

It's so simple...
I think I found this before the bug report and then forgot about it and
copied an old version. I'll update the bug report accordingly, if the latter
version works for you.

Philippe

Reply via email to