D - Sort the array of objects
I found if I sort an array of objects, like: Object[] array; array ~= new Object; array ~= new Object; ..... array.sort; Them will be sorted by address of object. Why not sort them by overloaded operator Object.cmp() ?
Aug 20 2003
"Kai" <Kai_member pathlink.com> wrote in message news:bhvlu4$1sd7$1 digitaldaemon.com...I found if I sort an array of objects, like: Object[] array; array ~= new Object; array ~= new Object; ..... array.sort; Them will be sorted by address of object. Why not sort them by overloaded operator Object.cmp() ?It does sort by Object.cmp(). The default implementation of Object.cmp() sorts by address. See phobos/object.d
Aug 28 2003