> On Feb 20, 2021, at 5:19 AM, Виктор Матузенко via fpc-pascal
> <[email protected]> wrote:
>
> Hi,
>
> I am trying to write some generic routines for working with containers. For
> example, GetLength function:
>
>
>
> unit u;
>
> {$MODE FPC}
> {$MODESWITCH DEFAULTPARAMETERS}
> {$MODESWITCH OUT}
> {$MODESWITCH RESULT}
>
> interface
>
> generic function GetLength<TContainter>(const V: TContainter): SizeUInt;
>
> implementation
>
> generic function GetLength<TContainter>(const V: TContainter): SizeUInt;
> begin
> Exit(V.Count);
> end;
>
> end.
The helper needs to be in the unit file so that GetLength() knows about Count().
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal