Feature to get or add value to an associative array.
Giles Bathgate
giles.bathgate at gmail.com
Mon Apr 16 18:59:54 UTC 2018
On Monday, 16 April 2018 at 12:41:07 UTC, JN wrote:
> It's only one additional "in", but makes the code more explicit
> and clear. I think in most cases, you will want to check if you
> are dealing with a fetched object or a default created one, so
> that will complicate the function even further.
You can still use a combination of `in` and the update syntax if
you want, this doesn't take that away. In the future, for a
concurrent implementation of associative arrays, a way of getting
or adding an element as an atomic operation becomes more
important. Either way the beauty of hashed based lookups is that
they average O(1), seems a shame to double that up for no reason
;)
More information about the Digitalmars-d
mailing list