[Issue 9119] New: Forward range addition to associative arrays.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 6 14:15:26 PST 2012


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

           Summary: Forward range addition to associative arrays.
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: maidenphil at hotmail.com


--- Comment #0 from Phil Lavoie <maidenphil at hotmail.com> 2012-12-06 14:15:25 PST ---
Providing a forward range to associative arrays would allow user to use
functionalities like "filter" and make their own (that return intelligent
ranges instead of eagerly constructing a result, then returning said result or
a range on it). It could be provided as a "range" property and "front" could
return an entry struct where entry.key is the key and entry.value is the value.

Example usage:
float[ Item ] itemsCost;
auto cheapItems = itemsCost.range.filter!"a.value < 5"();
foreach( cheap; cheapItems ) {
  sendGiftToEnemy( cheap.key );
}

-- 
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