#1 2017-03-11 16:09:48

Junior/RO
Member
Registered: 2011-05-13
Posts: 207

TSynDictionary type of keys?

Arnaud, if I declare a type to be used as a dictionary key in TSynDictionary:

TMyKey = record
           A, B: Double;
         end;
TMyKeyDynArray = array of TMyKey;

and initialize a TSynDictionary instance as

  D := TSynDictionary.Create(TypeInfo(TMyKeyDynArray), TypeInfo(TItensArray));

in a loop, we add itens to dictionary:

  K.A := SomeFuncionA;
  K.B := SomeFuncionB;
  if D.Exists(K) then { do something }
  else D.Add(K, SomeItem);

In the second pass of loop, I get a AV when call D.Exists().

Works when I change the key type to be a RawUTF8 or a variant.

This is by design?

Last edited by Junior/RO (2017-03-11 16:28:18)

Offline

#2 2017-03-11 20:17:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TSynDictionary type of keys?

No, I guess it should work as such...

Offline

Board footer

Powered by FluxBB