Should this work?
monarch_dodra
monarchdodra at gmail.com
Sat Jan 11 00:34:08 PST 2014
On Saturday, 11 January 2014 at 03:49:28 UTC, Manu wrote:
> On 11 January 2014 00:26, monarch_dodra
>> *However*, depending on the range type (non-transitive),
>> popping might
>> instantaneously invalidate the element you are operating on
>> (think
>> "byLine", that returns a "char[]", not a "string").
>>
>
> Since you mentioned it here yesterday, I thought 'byLine' would
> be useful
> this morning... but I can't find it!
> This is an embarrassing theme.
>
> Does it actually exist, and I am even further retarded... or
> did you just
> make that up?
It's because not actually a range adaptor or string adaptor, but
an stdio function:
http://dlang.org/phobos/std_stdio.html
http://dlang.org/phobos/std_stdio.html#.File.byChunk
http://dlang.org/phobos/std_stdio.html#.File.byLine
It's designed that way as to avoid allocating a new buffer.
Related:
That said, "std.algorithm.splitter" will lazily split a range of
characters into lines, if you give it the "right" terminator.
Unfortunately, it only accepts a single terminator, or a pred, so
you can't do "splitter('\n' "\r\n")".
You can also use
"http://dlang.org/phobos/std_string.html#.splitLines" to eagerly
and conveniently (and correctly) do this.
More information about the Digitalmars-d
mailing list