www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21015] New: aa.byKeyValue, byKey provide mutable reference

https://issues.dlang.org/show_bug.cgi?id=21015

          Issue ID: 21015
           Summary: aa.byKeyValue, byKey provide mutable reference access
                    to keys
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

e.g.:

int[int] aa;
aa[5] = 6;
foreach(ref k; aa.byKey) k = 10;

writeln(aa); // [10:6]

foreach(kvp; aa.byKeyValue) kvp.key = 11;

writeln(aa); // [11:6]

--
Jul 05 2020