I have noticed that, by using generics, we can't overload arithmetic
operators.

E.g.:

...
class operator Negative(A: TNullableType<T>): T;
...

class operator TNullableType<T>.Negative(A: TNullableType<T>): T;
begin
    Result := -1 * A;
end;
....

wouldn't compile with the error "Operator not applicable to this operand
type".

Is there any workaround to overcome this?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to