2016-08-17 16:05 GMT+02:00 silvioprog <silviop...@gmail.com>:

> I need to find the values using case-insensitive keys (I'm using it in a
> class registry of my app), so unfortunately this bug doesn't let me to use
> TDictionary on FPC yet. :-(


There is simple workaround:

=== begin code ===

function EqualityComparison(constref ALeft, ARight: string): Boolean;
begin
  Result := LowerCase(ALeft) = LowerCase(ARight);
end;

procedure ExtendedHasher(constref AValue: string; AHashList: PUInt32);
begin
  TDefaultHashFactory.GetHashList(Pointer(AValue), Length(AValue) *
SizeOf(Char), AHashList);
end;

var
  list: TDictionary<string, string>;
begin
  list := TDictionary<string,
string>.Create(TEqualityComparer<string>.Construct(EqualityComparison,
ExtendedHasher));

=== end code ===


-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to