D idom for removing array elements

Dukc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 27 00:20:30 PST 2017


On Thursday, 26 January 2017 at 23:10:02 UTC, albert-j wrote:
> Will it also work correctly and fast for arrays of custom 
> objects? How should opCmp() be defined if objects don't have a 
> meaningful ordering? The order of elements in the original 
> array does not matter.

Two options: either define opCmp for the custom objects, or 
define ordering for the sort algorithm (see std.algorithm in 
phobos documentation)




More information about the Digitalmars-d-learn mailing list