2016-03-01 9:13 GMT-03:00 Sven Barth <pascaldra...@googlemail.com>:

> Am 01.03.2016 04:08 schrieb "Mazola Winstrol" <mazofei...@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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to