Search for, o/w create element for AA

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 19 09:54:46 PDT 2017


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




More information about the Digitalmars-d-learn mailing list