[Lazarus] How to implement an iif with generic?

Paul Ishenin ip at kmiac.ru
Thu Jan 26 04:00:38 CET 2012


26.01.2012 10:13, silvioprog пишет:
> In the last test:
>
> function Max<T>(A, B: T): T;
> begin
>    if A<  B then
>      Result := B
>    else
>      Result := A;
> end;
>
> The error is: unit1.pas(30,13) Fatal: Syntax error, ":" expected but "<" found.
>
> What is the syntax for implementing a generic function? I'm trying to
> implement an faster iif function.

This is not yet implemented in the compiler.

Best regards,
Paul Ishenin.






More information about the Lazarus mailing list