Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-11

IComparer vs CompareFunc

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gennady Agranov

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

Reply by email