<div dir="ltr">Hello,<div><br></div><div>Looking an alternative to solve the problem I've talked at <a href="http://lists.freepascal.org/pipermail/fpc-pascal/2016-August/048635.html" target="_blank">this topic</a>, I've tried to solve it declaring a macro named "TIStringComparer.Ordinal":</div><div><br></div><div>=== begin code ===</div><div><br></div><div><div>{$IFDEF FPC}</div><div><br></div><div>function EqualityComparison(constref ALeft, ARight: string): Boolean;<br></div><div>begin</div><div>  Result := CompareText(ALeft, ARight) = 0;</div><div>end;</div><div><br></div><div>function ExtendedHasher(constref AValue: string): UInt32;</div><div>var</div><div>  S: string;</div><div>begin</div><div>  S := LowerCase(AValue);</div><div>  Result := TDefaultHashFactory.GetHashCod<wbr>e(Pointer(S), Length(S) * SizeOf(Char), 0);</div><div>end;</div><div><br></div><div>// see <a href="http://lists.freepascal.org/pipermail/fpc-pascal/2016-August/048635.html" target="_blank">http://lists.freepascal.org/pi<wbr>permail/fpc-pascal/2016-August<wbr>/048635.html</a></div><div>{$MACRO ON}</div><div>{$DEFINE TIStringComparer.Ordinal := TEqualityComparer<string>.Cons<wbr>truct(EqualityComparison, ExtendedHasher) }</div><div><br></div><div>{$ENDIF}</div><div><br></div><div>=== end code ===<br></div><div><br></div><div>The macro is just for retro-compatibility with Delphi, allowing to use this syntax:</div><div><br></div><div>GVariables := TDictionary<string, string>.Create(TIStringCompare<wbr>r.Ordinal); // the macro should replace it, but ...<br></div><div><br></div><div>However, it seems the macro can't replace the original "TIStringComparer.Ordinal" to my "TEqualityComparer<string>.Con<wbr>struct(EqualityComparison, ExtendedHasher)" definition.</div><div><br></div><div>So, is macro indicated to solve this kind of problem?</div><div><br></div><div>--<br><div><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div></div>