Dynamic associative array, to hold many values per key

Daniel Davidson nospam at spam.com
Tue Oct 29 18:14:51 PDT 2013


On Tuesday, 29 October 2013 at 18:02:46 UTC, Logesh Pillay wrote:
> On Sunday, 20 October 2013 at 16:08:50 UTC, bearophile wrote:
>> Logesh Pillay:
>>
>>> Thanks.  Coming to D from python, I have to say D's tuples 
>>> look difficult.  I'm going to see how far I can get with 
>>> structs writing my sudoku solver.
>>
>> I think defining the full correct hashing protocol manually 
>> for structs is harder than using tuples.
>>
>> There were many discussions to improve and simplify D tuples, 
>> but nothing has come out of them yet.
>>
>> Bye,
>> bearophile
>
> This thread is dead.  But I'm just posting to say using struct 
> as a key to an associative array worked fine without opHash and 
> other special methods.  Does that mean (Alexandrescu, ch 4.4.7) 
> that the array retrieves slower (The sudoku solver seems fast 
> enough though) If so, there is an obvious way to write (x, y) 
> as an int: 10x + y

What do you mean when you say "using a struct as a key to an 
associative array worked fine without opHash and other special 
methods? Do you have sample code showing it work?


More information about the Digitalmars-d-learn mailing list