[Lazarus] How to implement an iif with generic?

silvioprog silvioprog at gmail.com
Sun Jan 29 02:09:28 CET 2012


2012/1/26 Paul Ishenin <ip at kmiac.ru>:
> 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.

Thanks.

-- 
Silvio Clécio
====================================
Site - <silvioprog.com.br>
LazSolutions - <code.google.com/p/lazsolutions>
====================================




More information about the Lazarus mailing list