<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 17, 2016 at 12:20 PM, Maciej Izak <span dir="ltr"><<a href="mailto:hnb.code@gmail.com" target="_blank">hnb.code@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span><br><div class="gmail_quote">2016-08-17 16:05 GMT+02:00 silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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. :-(</blockquote></div><br></span>There is simple workaround:</div><div class="gmail_extra"><br></div><div class="gmail_extra">=== begin code ===</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">function EqualityComparison(constref ALeft, ARight: string): Boolean;</div><div class="gmail_extra">begin</div><div class="gmail_extra"> Result := LowerCase(ALeft) = LowerCase(ARight);</div><div class="gmail_extra">end;</div><div class="gmail_extra"><br></div><div class="gmail_extra">procedure ExtendedHasher(constref AValue: string; AHashList: PUInt32);</div><div class="gmail_extra">begin</div><div class="gmail_extra"> TDefaultHashFactory.GetHashLis<wbr>t(Pointer(AValue), Length(AValue) * SizeOf(Char), AHashList);<br></div><div class="gmail_extra">end; </div></div><div class="gmail_extra"><br></div><div class="gmail_extra">var</div><div class="gmail_extra"> list: TDictionary<string, string>;</div><div class="gmail_extra">begin</div><div class="gmail_extra"> list := TDictionary<string, string>.Create(TEqualityCompar<wbr>er<string>.Construct(<wbr>EqualityComparison, ExtendedHasher));</div><div class="gmail_extra"><br></div><div class="gmail_extra">=== end code ===</div></div></blockquote></div><div class="gmail_extra"><br></div><div class="gmail_extra">I changed it to a function:<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"> function ExtendedHasher(constref AValue: string): UInt32;</div><div class="gmail_extra"> begin</div><div class="gmail_extra"> TDefaultHashFactory.<wbr>GetHashList(Pointer(AValue),</div><div class="gmail_extra"> Length(AValue) * SizeOf(Char), @Result);</div><div class="gmail_extra"> end;</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">because the "Error: Incompatible type for arg no. 2: Got "ExtendedHasher(constref AnsiString;PDWord);", expected "<procedure variable type of function(constref AnsiString):DWord;Register>"".</div><div class="gmail_extra"><br></div><div class="gmail_extra">Anyway, thanks for the workaround, it can fix the FPC version of my tests. :-)</div><div class="gmail_extra"><br></div>--<br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div>