std.algorithm.cmp doesn't seem to support numeric types?

Dennis dkorpel at gmail.com
Wed Oct 16 21:34:35 UTC 2019


On Wednesday, 16 October 2019 at 20:07:10 UTC, Adam D. Ruppe 
wrote:
> Notice that the docs say "a negative value" rather than -1 
> specifically. That's because the implementation for integers an 
> be as simple as
>
> return a - b; // if b > a, you get a negative value

Except that e.g. -2 - int.max underflows to int.max suggesting 
that int.max < -2.


More information about the Digitalmars-d-learn mailing list