> On Jun 1, 2021, at 12:20 PM, denisgolovan via fpc-pascal
> <[email protected]> wrote:
>
> Hi all
>
> I am trying to implement Option<T> type in FPC.
>
> type
> generic TOption<T> = record
> case IsSome:boolean of
> true: ( some: T );
> false: ();
> end;
You need to use a constraint like:
type
generic TOption<T: TObject> = record
case IsSome:boolean of
true: ( some: T );
false: ();
end;
Not sure why though.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal