Overloading relational operators separately; thoughts?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 1 04:33:58 PDT 2016


On 10/1/16 3:13 AM, Martin Nowak wrote:
> The fact that it's not possible to overload < but have to use the
> ternary opCmp is even a performance problem. All std algorithms only use
> less as a predicate, leading to lots of unnecessary cycles when e.g.
> sorting UDTs.

I've also been often annoyed by having to write

return a < b ? -1 : a > b;

in e.g. checkedint. Does inlining take care of this? -- Andrei



More information about the Digitalmars-d mailing list