On 4/2/16 10:22 AM, Temtaime wrote:
Hi !
I can't find this in specs.

If i add an element to AA:
aa[10] = 123;

Will &aa[10] be always the same (of course i don't remove that key) ?

Thanks for a reply.
I think specs should be enhanced.

Depends on your definition of "always". As long as you don't add or remove keys, it will remain at the same place. Adding other keys can cause a rehash, and removing keys (even if it isn't that one) can cause a rehash.

Note: in the current implementation, it WILL remain in the same location, even on a rehash. This is because the AA is implemented as an array of pointers to elements. A rehash does not reallocate the elements. But this is NOT guaranteed to stay this way in the future.

Note: reason the spec does not say this is because we don't want to constrain the implementation to behave a certain way.

-Steve

Reply via email to