String joining an array of structs or class instances implementing toString?
pineapple via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 11 05:43:49 PST 2016
On Thursday, 11 February 2016 at 12:53:20 UTC, Edwin van Leeuwen
wrote:
> I'd do it like this:
>
> import std.algorithm : map;
> pars.map!((part) => part.toString) // Turn them to strings
> .join(" ").writeln; // Join them.
Thanks! Does the map function iterate without constructing an
extra list in-memory?
More information about the Digitalmars-d-learn
mailing list