non empty slices

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 2 16:17:52 PDT 2016


On Thursday, 2 June 2016 at 22:17:32 UTC, ag0aep6g wrote:
>
> Yeah, can't do it that way. You have only one f_impl call, but 
> want it to go to different overloads based on dynamic 
> information (caseS). That doesn't work.
>
> You need three different f_impl calls. You can generate them, 
> so there's only one in the source, but it's a bit involved:
>
>     sw: switch (caseS)
>     {
>         foreach (i, T; TL)
>         {
>             case i: f_impl(result.get!T); break sw;
>         }
>         default: assert(false);
>     }
Oh... wow... cool! :)
But still, I can't mark the f-method @nogc, and this is not due 
to the writeln calls... why GC is invoked, although everything is 
known and no memory allocation should happen?


More information about the Digitalmars-d-learn mailing list