[fpc-devel] IComparer vs CompareFunc

Gennady Agranov gennadyagranov at gmail.com
Mon Nov 24 20:53:45 CET 2014


Hi,

I am trying to have some code that uses generics to compile under Delphi
and under FPC (uses fgl)

In Delphi I pass IComparer<T> and in FPC TCompareFunc<T>

IComparer<T> is an object and I can create it with some state that compare
method can use :)

In FPC I should pass function:

TCompareFunc = function(const Item1, Item2: T): Integer;

And I am not sure where I can add my state information that compare will
use - it is not and object function :(

Any help will be appreciated!

Thanks,
Gennady
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20141124/97ea9658/attachment.html>


More information about the fpc-devel mailing list