Re: [fpc-pascal] Comparison operator for generics

2017-09-12 Thread Michael Van Canneyt
On Tue, 12 Sep 2017, Ryan Joseph wrote: On Sep 12, 2017, at 4:46 PM, Maciej Izak wrote: Please check example at : packages\rtl-generics\examples\tcomparer\tcomparerproject.lpr Thanks. What is the & here? TCompare.&String(Left.Name, Right.Name); I don’t think I’ve ever seen that befor

Re: [fpc-pascal] Comparison operator for generics

2017-09-12 Thread Ryan Joseph
> On Sep 12, 2017, at 4:46 PM, Maciej Izak wrote: > > Please check example at : > packages\rtl-generics\examples\tcomparer\tcomparerproject.lpr Thanks. What is the & here? TCompare.&String(Left.Name, Right.Name); I don’t think I’ve ever seen that before. Regards, Ryan Joseph _

Re: [fpc-pascal] Comparison operator for generics

2017-09-12 Thread Maciej Izak
2017-09-12 7:59 GMT+02:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: > You could try to use the TEqualityComparer<> (or so) types from the > rtl-generics package (don't know in which unit exactly they are ^^') as > those can work with records without operator overloads. > Gener

Re: [fpc-pascal] Comparison operator for generics

2017-09-12 Thread Maciej Izak
2017-09-12 11:07 GMT+02:00 Ryan Joseph : > > Do any examples of how to use the class exist? I searched around and > couldn’t find a single snippet even though it appears to exist in Delphi. Please check example at : packages\rtl-generics\examples\tcomparer\tcomparerproject.lpr -- Best regards,

Re: [fpc-pascal] Comparison operator for generics

2017-09-12 Thread Ryan Joseph
> On Sep 12, 2017, at 12:59 PM, Sven Barth via fpc-pascal > wrote: > > You could try to use the TEqualityComparer<> (or so) types from the > rtl-generics package (don't know in which unit exactly they are ^^') as those > can work with records without operator overloads. > Do any examples of

Re: [fpc-pascal] Comparison operator for generics

2017-09-11 Thread Sven Barth via fpc-pascal
Am 12.09.2017 06:49 schrieb "Ryan Joseph" : > > This is a common pattern I’m finding when working with generics in FPC. In the example below there is an equals comparison that needs to be checked but for some types such as records there is no default operator overload so I need to add one for every

[fpc-pascal] Comparison operator for generics

2017-09-11 Thread Ryan Joseph
This is a common pattern I’m finding when working with generics in FPC. In the example below there is an equals comparison that needs to be checked but for some types such as records there is no default operator overload so I need to add one for every record that will be specialized in the class