std.algorithm.reduce on an array of structs

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 11 14:11:07 PDT 2014


On Thursday, 11 September 2014 at 14:49:03 UTC, bearophile wrote:
> void main() {
>       //... 	
>
> 	immutable ar2 = [Thing(10), Thing(20), Thing(40)];
> 	ar2.minimum.writeln;
> }
>
> Bye,
> bearophile

Even better:

void main
{
     immutable(Thing)[] ar2 = [10, 20, 40];
     ar2.minimum.writeln;
}


More information about the Digitalmars-d-learn mailing list