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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 24 01:18:57 PDT 2013


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



--- Comment #9 from khurshid <khurshid.normuradov at gmail.com> 2013-04-24 01:18:55 PDT ---
I'm not sure, but, is this right?

template MostDerived(T, TList...)
{
    static if (TList.length == 0)
    {
       alias MostDerived = T;
    }
    else static if (TList.length == 1 )
    {
         static if (is (TList[0] : T) )
         { 
             alias  MostDerived = TList[0];
         }
         else
         {
             alias MostDerived = T;
         }
    }
    else
    {
       alias Half = MostDerived!(T, TList[0..$/2]);
       alias MostDerived = MostDerived!(Half, TList[$/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