www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4607] New: Make .byValue() and .byKey() of associative arrays adopt the input range interface.

reply d-bugmail puremagic.com writes:
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 invisibleduck.org
        ReportedBy: kennytm gmail.com


--- Comment #0 from kennytm 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: -------
Aug 09 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4607


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2012-01-17 14:05:16 PST ---
*** Issue 7148 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 17 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4607


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from bearophile_hugs eml.cc 2012-01-17 14:06:29 PST ---
Fixed here:

https://github.com/D-Programming-Language/druntime/commit/8bca49ce59dd9599085775b4dc9ed37e67241b87

https://github.com/D-Programming-Language/druntime/commit/b4d95e4db945ec443b391bf2e1746826f0acf57d

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