[Issue 9976] Needlessly large instantiation depth in std.typetuple algorithms

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 23 01:05:54 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9976



--- Comment #6 from khurshid <khurshid.normuradov at gmail.com> 2013-04-23 01:05:52 PDT ---
(In reply to comment #5)
> And this :))
> 
> template Reverse(TList...)
> {
>     static if (TList.length <= 1 )
>         alias TList Reverse;
>     else 
>         alias TypeTuple!( TList[$-1], Reverse!(TList[1..$-1]), TList[0])
> Reverse;
> 
> }
> 
> :)))

or 

template Reverse (TList...)
{
    static if (TList.length <= 1 )
    {
        alias Reverse  = TList;
    } else {
        alias Reverse  = TypeTuple!( Reverse !(TList[$/2..$]) ,
Reverse!(TList[0..$/2]));
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list