Thread overview
[Issue 816] New: .dup for associative arrays
Jan 08, 2007
d-bugmail
Apr 26, 2007
d-bugmail
Apr 26, 2007
d-bugmail
Apr 17, 2010
Michael Rynn
Apr 17, 2010
Michael Rynn
January 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=816

           Summary: .dup for associative arrays
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thecybershadow@gmail.com


Since associative arrays are reference types, the language currently doesn't provide a straight-forward way to duplicate an associative array. As a small enhancement towards general language consistency, I would like to suggest a .dup property, like for dynamic arrays, which returns a copy of the associative array.


-- 

April 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=816





------- Comment #1 from wbaxter@gmail.com  2007-04-25 20:26 -------
I second that.  I was surprised to find out just now when the compiler told me
it didn't exist for AAs.
(Is there a workaround?  Does  assigning to another AA make a copy?)


-- 

April 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=816





------- Comment #2 from thecybershadow@gmail.com  2007-04-25 20:28 -------
The "workaround" is:
foreach(key,value;aa1)aa2[key]=value;
This can easily be made into a template function.


-- 

April 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=816


Michael Rynn <y0uf00bar@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y0uf00bar@gmail.com


--- Comment #3 from Michael Rynn <y0uf00bar@gmail.com> 2010-04-17 04:33:49 PDT ---
See enhancement 4098

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=816



--- Comment #4 from Michael Rynn <y0uf00bar@gmail.com> 2010-04-17 04:50:51 PDT ---
I added a .dup to enhancement 4098

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=816


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei@metalanguage.com
         Resolution|                            |FIXED


--- Comment #5 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-01-08 12:01:18 PST ---
druntime revision 488.

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