[fpc-pascal] Primitive Record Wrappers

Mazola Winstrol mazofeifer at gmail.com
Mon Feb 29 16:13:21 CET 2016


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160229/5bd0a3fb/attachment.html>


More information about the fpc-pascal mailing list