Bug 5951 – writeln(AAbyValue()) doesn't show the values
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-05-07T16:24:00Z
Last change time
2015-06-09T05:15:08Z
Keywords
wrong-code
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2011-05-07T16:24:13Z
import std.stdio;
void main() {
int[int] hash = [1:2, 3:4];
auto vals = hash.byValue();
writeln(vals);
}
With DMD 2.053beta at runtime the writeln prints:
int delegate(int delegate(ref int))
Expected: the sequence of the items, something like:
[2; 4]
See also bug 3813
Comment #1 by kennytm — 2011-05-08T00:07:33Z
Please make this request WONTFIX. AA.byValue simply returns a delegate as shown in the report. writeln doesn't know if the delegate is from byValue, or just a normal delegate, not intended for iteration.
The correct solution is to make byValue a forward range.
And please stop filing the same bug again and again :). You have already filed bug 4704 which item #2 is exactly the same as this one.
*** This issue has been marked as a duplicate of issue 4704 ***