import std.algorithm;

int toInt(char c) { return 1; }

void main()
{
    map!(a => toInt(a))("hello");
}

Can someone please explain why I get this:

Bug.d(10): Error: function Bug.toInt (char c) is not callable using argument types (dchar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
D:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(425): Error: template instance Bug.main.__lambda1!dchar error instantiating D:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(411): instantiated from here: MapResult!(__lambda1, string)
Bug.d(10):        instantiated from here: map!string
D:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(411): Error: template instance Bug.main.MapResult!(__lambda1, string) error instantiating
Bug.d(10):        instantiated from here: map!string
Bug.d(10): Error: template instance Bug.main.map!((a) => toInt(a)).map!string error instantiating

I thought that string == immutable char[], but this implies that it is getting inferred as dchar[], I guess.

Dave

Reply via email to