On Monday, 19 June 2017 at 16:54:46 UTC, Ali Çehreli wrote:
On 06/19/2017 08:19 AM, Q. Schroll wrote:

Can't I tell the AA to set a value for a given key if it doesn't already
have one
 (1) with only one lookup, and
 (2) in a safe way?

aa.get(key, defaultValue)

  https://dlang.org/spec/hash-map.html#properties

Ali

aa.get returns the defaultValue if the key is not in the AA, but does not add the key-value pair (x, defaultValue) to the AA. I'd find it rather surprising if it did.

Reply via email to