[Issue 4607] New: Make .byValue() and .byKey() of associative arrays	adopt the input range interface.
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Aug  9 10:26:48 PDT 2010
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=4607
           Summary: Make .byValue() and .byKey() of associative arrays
                    adopt the input range interface.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: sean at invisibleduck.org
        ReportedBy: kennytm at gmail.com
--- Comment #0 from kennytm at gmail.com 2010-08-09 10:26:46 PDT ---
Currently .byValue() and .byKey() returns a delegate. This make it only
iterable by foreach, but cannot be used in std.algorithm algorithms, e.g.
----
import std.algorithm;
import std.stdio;
void main () {
   auto x = ["a":4, "b":6];
   writeln( reduce!"a+b"( map!"a*a"( x.byValue() ) ) );
}
----
While it is possible to use .values and .keys, both of these create a copy of
the array, which is unnecessary for many codes like the one above.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list