[generics.collections] Sort expects constref while Delphi wants const for parameters
Original Reporter info from Mantis: rd0x
-
Reporter name:
Original Reporter info from Mantis: rd0x
- Reporter name:
Description:
If you create a TObjectList&LtPos;MyClass> and call classvar.Sort(TComparer&LtPos;MyClass>.Construct(_CompareNames)); you need to define the function _CompareNames (only way as FPC does not know anonymous functions) with 'constref' for FPC while Delphi needs 'const'
FPC:
function _CompareNames(constref left, right: MyClass): Integer;
Delphi Rio:
function _CompareNames({const left, right: MyClass): Integer;
Additional information:
Error: Incompatible type for arg no. 1: Got "_CompareNames(const MyClass;const MyClass):LongInt;", expected "&LtPos;procedure variable type of function(constref MyClass;constref MyClass):LongInt;Register>"
Mantis conversion info:
- Mantis ID: 35828
- Build: 3.2.0-beta [2019/07/01]
- Version: 3.2.0