www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9491] New: allow for insert/return pointer to existing value if present on assoc array

http://d.puremagic.com/issues/show_bug.cgi?id=9491

           Summary: allow for insert/return pointer to existing value if
                    present on assoc array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: dbdavidson yahoo.com


--- Comment #0 from Daniel Davidson <dbdavidson yahoo.com> 2013-02-09 11:18:08
PST ---
By providing something like:

auto ptrToValue = hash.insertDefaultOrFind(key, init)
*ptrToValue += additional;

client code can perform an <insert if not present/lookup> combined so that on
the
case of a nonexistent key, 1 toHash/lookup can be done instead of 3.

The best recap of what is needed is in this thread:
http://forum.dlang.org/post/mailman.1081.1360269373.22503.digitalmars-d-learn puremagic.com

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2013