How to use map?
Lemonfiend via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 11 06:05:09 PST 2014
> The code you were trying to write:
>
> struct Foo(T) {
> T t;
> }
>
> void main() {
> import std.stdio, std.algorithm, std.array;
>
> float[] vals = [1.1, 2.1, 3.1, 4.1];
> auto arr = vals.map!(Foo!float).array;
> arr.writeln;
> }
Sorry, my example had an unneeded template. Simply this (and also
your code)
---
struct S
{
float f;
}
---
still results in an undefined identifier.
More information about the Digitalmars-d-learn
mailing list