How to "extend" built-in types
Jonathan M Davis
jmdavisProg at gmx.com
Fri Oct 26 08:54:49 PDT 2012
On Friday, October 26, 2012 15:55:34 simendsjo wrote:
> So.. What do I need to implement for a struct to be a valid
> built-in type?
> All valid properties (min, max etc) and operators for that type?
So, you want stuff like isFloatingPoint and isNumeric to return true for a
user-defined struct? That pretty much defeats their purpose if that happens.
They're checking for exact matches, not implicit conversions, and a function
intended to work explicitly with float isn't necessarily going to work with
your struct, so it needs isFloatingPoint to be false for something that isn't
truly a built-in floating point type.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list