Editions Ideas
Dom Disc
dominikus at scherkl.de
Sat Dec 13 10:33:10 UTC 2025
On Saturday, 13 December 2025 at 10:18:30 UTC, Dom Disc wrote:
> - unitary operators NOT modifying the type of their operand
And if you want something changing the type of the operand, then
define
Unsigned!T abs(T)(T v) => cast(Unsigned!T)(v<0 ? -v : v);
(fixing the long standing bug that abs(int.min) < 0)
Together with the above change this would also rectify why abs is
not an unary operator.
More information about the Digitalmars-d
mailing list