On 09/13/2015 07:16 PM, Daniel N wrote: > > Could you try this? > > int opCmp(Foo rhs) > { > return (id > rhs.id) - (id < rhs.id); > } That's not the point, opCmp requires twice as many comparisons as needed for <. If they are more expansive, e.g. string comparison, your trick won't work.