[fpc-pascal] Primitive Record Wrappers
Mazola Winstrol
mazofeifer at gmail.com
Tue Mar 1 13:48:32 CET 2016
2016-03-01 9:13 GMT-03:00 Sven Barth <pascaldragon at googlemail.com>:
> Am 01.03.2016 04:08 schrieb "Mazola Winstrol" <mazofeifer at gmail.com>:
> > Is there any way to overcome this? Is there any way to tell the compiler
> to ignore some operators depending on the specialization type?
>
> No, there is not. Better not use operators other than the assignment ones
> or provide different Nullable types for different purposes (that maybe can
> be assigned to each other).
>
The problem is type the same structures for the various nullable types.
Perhaps, a "ugly" solution would be:
===== code =========
{$mode delphi}
{$DEFINE typename:=TSimpleNullableType<T>}
typename = record
strict private
{$INCLUDE commonprivatedefinition.inc}
public
{$INCLUDE commonprivatedefinition.inc}
end;
{$DEFINE typename:=TArithmeticNullableType<T>}
typename = record
strict private
{$INCLUDE commonprivatedefinition.inc}
public
{$INCLUDE commonprivatedefinition.inc}
class operator Negative(A: TArithmeticNullableType<T>): T;
end;
==== code ======
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160301/201f1359/attachment.html>
More information about the fpc-pascal
mailing list