Thread overview | ||||||
---|---|---|---|---|---|---|
|
December 06, 2012 [Issue 9119] New: Forward range addition to associative arrays. | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: maidenphil@hotmail.com --- Comment #0 from Phil Lavoie <maidenphil@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: ------- |
December 07, 2012 [Issue 9119] Forward range addition to associative arrays. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phil Lavoie | http://d.puremagic.com/issues/show_bug.cgi?id=9119 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2012-12-06 17:49:48 PST --- See Issue 5075 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 15, 2013 [Issue 9119] Forward range addition to associative arrays. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phil Lavoie | http://d.puremagic.com/issues/show_bug.cgi?id=9119 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |hsteoh@quickfur.ath.cx --- Comment #2 from hsteoh@quickfur.ath.cx 2013-08-15 12:23:05 PDT --- https://github.com/D-Programming-Language/druntime/pull/574 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 15, 2013 [Issue 9119] Forward range addition to associative arrays. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phil Lavoie | http://d.puremagic.com/issues/show_bug.cgi?id=9119 --- Comment #3 from hsteoh@quickfur.ath.cx 2013-08-15 12:33:54 PDT --- Using the code in the pull request, this code works: import std.algorithm; import std.conv; import std.stdio: writeln; void main () { int[string] aa; aa["a"] = 1; aa["b"] = 2; aa["c"] = 3; writeln(aa.byPair .map!((a) => "key=" ~ a.key ~ " value=" ~ to!string(a.value)) .joiner("\n") ); } The output is: key=a value=1 key=b value=2 key=c value=3 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation