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 of this AA by a "reference"? In C++ I can use reference to an element of the map:
Foo& foo = records.find(3).second;
foo.value = 10;
foo.name = "name";

I found that in D I can use a "with" keyword to achieve the same effect:
with(values[0]) {
    value = 10;
    name = "name";
}

Is this the only optimal way?

Reply via email to