Explicitly saying ref or out when invoking a function

bearophile bearophileHUGS at lycos.com
Tue Aug 11 13:28:06 PDT 2009


BCS Wrote:
> It would make template programming harder.
> 
> template TplFn(alias fn)
> {
>     void TplFn(T...)(T t)
>     {
>         fn(t); // what if fn has normal, ref and out args?
>     }
> }

There's an intermediate solution, to make "ref" optional at the calling site (as in the "override" case). I don't know how much this can improve the situation.

Bye,
bearophile



More information about the Digitalmars-d mailing list