[Issue 20117] std.typecons.Typedef has opCmp when base type does not

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 9 07:14:08 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20117

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
This would perhaps more correctly be filed as 'int does not have opCmp'. Since
int does support the <, <=, >=, > operators it kinda, sorta has opCmp, but no
member by that name. That's not really an option for Typedef, as it's not a
magic type like int. At the same time, we absolutely expect MyInt.init <
MyInt.init to compile.

There may be a good argument for adding opCmp and friends to built-in types to
make generic code more generic, but removing them from Typedef is no solution.

--


More information about the Digitalmars-d-bugs mailing list