std.algorithm.reduce on an array of structs

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 11 19:10:56 PDT 2014


On Thursday, 11 September 2014 at 21:28:59 UTC, Colin wrote:
> Using the "alias x this" solution would work, but my actual 
> struct is not a simple struct, so the comparison isn't exactly 
> (a.x < b.x).

You could always override opCmp as well:

http://dlang.org/operatoroverloading.html#compare


More information about the Digitalmars-d-learn mailing list