I wonder what sort of operator overloads are possible (and with what version of Delphi)?
Thanks to Hallvard’s great write-up on operator overloading, I know of :
- Add(Left, Right: Type): Type (for the ‘+’ operator)
- Subtract(Left, Right: Type): Type (for the ‘-‘ operator)
- Multiply(Left, Right: Type): Type (for the ‘*’ operator)
- Divide(Left, Right: Type): Type (for the ‘/’ operator)
- Implicit(aValue: Type): AnotherType and
- Implicit(aValue: AnotherType): Type (for implicit assignments : a := b)
- Explicit(aValue: Type): AnotherType and
- Explicit(aValue: AnotherType): Type (for explicit assignmetns of ‘casts’ : a := Type(b)
However, what I don’t know are the names for the ‘=’, ‘<=’, ‘<‘, ‘<>’, ‘>’ and ‘>=’ operators. Do these exist, and from what Delphi version can I use these?
PS: I still use Delphi 2009 at the moment, so I would have another strong upgrade-argument if 2010 offers these 😉
Actually, I found the answer to this myself, but kept the question as I can imagine people will search for this information regularly on stackoverflow;
The official description on operator overloaders can be found here : http://docwiki.embarcadero.com/RADStudio/en/Operator_Overloading_(Delphi)
Mainly, the ones I was looking for are named: