Re: Accessing contents of associative arrays in an optimal way

2016-07-09 Thread phant0m via Digitalmars-d-learn
Thank you!

Re: Accessing contents of associative arrays in an optimal way

2016-07-09 Thread ag0aep6g via Digitalmars-d-learn
On 07/09/2016 10:32 PM, phant0m wrote: As far as I know, AA implemented as a hashtable. So, will there be two searches performed (one search for each line)? records[3].value = 10; records[3].name = "name"; Yup. A good optimizer may be able to eliminate one, but conceptually there are two looku

Re: Accessing contents of associative arrays in an optimal way

2016-07-09 Thread Ali Çehreli via Digitalmars-d-learn
On 07/09/2016 01:32 PM, phant0m wrote: > Suppose I have AA of structures: > > struct Foo { > int value; > string name; > } > > Foo[int] records; > > As far as I know, AA implemented as a hashtable. So, will there be two > searches performed (one search for each line)? > records[3].value

Accessing contents of associative arrays in an optimal way

2016-07-09 Thread phant0m via Digitalmars-d-learn
Suppose I have AA of structures: struct Foo { int value; string name; } Foo[int] records; As far as I know, AA implemented as a hashtable. So, will there be two searches performed (one search for each line)? records[3].value = 10; records[3].name = "name"; How can I access elements o