DIP 1030--Named Arguments--Community Review Round 1 Discussion

Timon Gehr timon.gehr at gmx.ch
Tue Feb 11 09:29:22 UTC 2020


On 10.02.20 20:46, Adam D. Ruppe wrote:
> 
> It is super simple. Consider this example:
> 
> ---
> template wrapWithPrint(alias fn) {
>          static if(is(typeof(fn) P == __parameters))
>          auto wrapWithPrint(P params) {
>                  import std.stdio;
>                  writeln(params);
>                  auto ret = fn(params);
>                  writeln("returned: ", ret);
>                  return ret;
>          }
>          else static assert(0);
> }
> ---

int troll(int ret){ return ret; }

void main(){
     wrapWithPrint!troll(2);
}


More information about the Digitalmars-d mailing list