I dun a DIP, possibly the best DIP ever

Walter Bright newshound2 at digitalmars.com
Sat Apr 25 21:33:35 UTC 2020


On 4/25/2020 3:27 AM, Stefan Koch wrote:
>       template Add3(alias y)
>       {
>          enum Add3 = y + 3;
>       }
> 
>       enum x = staticMap!(Add3, big_seq).length;

Can also do:

     enum x = staticMap!("a + 3", big_seq).length;

or:

     enum x = staticMap!(y => y + 3, big_seq).length;

which looks a little nicer.


More information about the Digitalmars-d mailing list