Bug 5952 – map(AA.byValue()) problem

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-05-07T16:27:00Z
Last change time
2015-06-09T05:15:05Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-05-07T16:27:16Z
import std.algorithm; void main() { int[int] hash = [1:2, 3:4]; auto vals = hash.byValue(); map!q{a}(vals); // error } The line of code with "map" causes this (DMD 2.053beta): test.d(5): Error: template std.algorithm.map!("a").map(Range) if (isInputRange!(Unqual!(Range))) does not match any function template declaration test.d(5): Error: template std.algorithm.map!("a").map(Range) if (isInputRange!(Unqual!(Range))) cannot deduce template function from argument types !()(int delegate(int delegate(ref int) dg))
Comment #1 by kennytm — 2011-05-08T00:00:18Z
That's because byValue returns an opApply delegate, not a range. *** This issue has been marked as a duplicate of issue 4264 ***
Comment #2 by bearophile_hugs — 2011-05-08T03:35:46Z
(In reply to comment #1) > That's because byValue returns an opApply delegate, not a range. > > *** This issue has been marked as a duplicate of issue 4264 *** This is not a duplicate of 4264. Here I am not asking map() to use opApply, I am asking byValue() to be a Range, if possible.
Comment #3 by kennytm — 2011-05-08T04:37:55Z
(In reply to comment #2) > (In reply to comment #1) > > That's because byValue returns an opApply delegate, not a range. > > > > *** This issue has been marked as a duplicate of issue 4264 *** > > This is not a duplicate of 4264. Here I am not asking map() to use opApply, I > am asking byValue() to be a Range, if possible. Then it is still a dup of bug 4607.