Using std.algorithm.map: Error: cannot implicitly convert expression of type MapResult!

Dfr deflexor at yandex.ru
Mon Dec 9 21:54:44 PST 2013


Hello, here is example code, which doesn't work:

     Variant[] vtypes = [ Variant("hello"), Variant("bye") ];
     string[] filetypes = map!(to!string)(vtypes);

Gives me error:

Error: cannot implicitly convert expression (map(vtypes)) of type 
MapResult!(to, VariantN!(24u)[]) to string[]
....

And alternative version:

     Variant[] vtypes = [ Variant("hello"), Variant("bye") ];
     string[] ftypes = map!(t => t.get!(string))(vtypes);

Error: cannot implicitly convert expression (map(vtypes)) of type 
MapResult!(__lambda2, VariantN!(24u)[]) to string[]
....

What is wrong here and how to fix it ?


More information about the Digitalmars-d-learn mailing list