std.array oddness

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 14 00:08:19 PST 2014


On Sun, 14 Dec 2014 05:15:43 +0000
earthfront via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via 
> Digitalmars-d-learn wrote:
> >     auto names = File("names.txt")
> >         .byLine!(char,char)(KeepTerminator.no, ',')
> >         .map!"a.idup"
> >         .array;
> 
> Awesome. "map!idup" does the trick.
> 
> I had looked at the "byLine" doc before posting, in particular, 
> this line:
> "Note:
> Each front will not persist after popFront is called, so the 
> caller must copy its contents (e.g. by calling to!string) if 
> retention is needed."
> 
> This explains the behavior though I didn't get it then. It's 
> talking about the "range" methods.
> Following the component based stuff from Walter's article can be 
> brain-bendy. And in this case, requires careful reading of the 
> docs.
> But I like it.
it's a matter of time to become used with that "ranges" stuff. but then
you will start seeing ranges everywhere. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141214/38cfa7ff/attachment.sig>


More information about the Digitalmars-d-learn mailing list