I dun a DIP, possibly the best DIP ever

Simen Kjærås simen.kjaras at gmail.com
Fri Apr 24 05:12:08 UTC 2020


On Friday, 24 April 2020 at 04:22:47 UTC, Walter Bright wrote:
> On 4/22/2020 6:18 AM, Steven Schveighoffer wrote:
>> int double_int(int val) { return 2 * val; }
>> 
>> T double_int(T val) { return val; }
>> 
>> void double_ints(alias pred, T... args) {
>>     pred(double_int(args)...);
>> }
>
> This can be done with the array syntax proposal using UFCS:
>
> void double_ints(alias pred, T... args) {
>     args.pred();
> }

And how does this work for staticMap, which is essentially the 
same as double_ints above, but pred is a template?

template staticMap(alias Fn, T...) {
     alias staticMap = args.// what do I put here to invoke array 
syntax?
}

--
   Simen


More information about the Digitalmars-d mailing list