www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14386] New: add setOrGet to AA


          Issue ID: 14386
           Summary: add setOrGet to AA
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

The function is called setdefault in python and getOrElseUpdate in Scala.

Allows to lookup a key or set a value with a single hash.
This is also possible in C++ using iterators.


Another primitive that could work here is getLValue, but it requires the value
type to have a distinct null value, so it's less nice to work with.

Mar 31 2015