Multidimensional dynamic array of strings initialized with split()

Ludovit Lucenic llucenic at gmail.com
Wed Sep 4 16:18:34 PDT 2013


On Wednesday, 4 September 2013 at 23:06:10 UTC, H. S. Teoh wrote:
>
> The problem is that File.byLine() reuses its buffer for 
> efficiency, and
> split is optimized to return slices into that buffer instead of 
> copying
> each substring. So after every iteration the buffer (and 
> therefore the
> slices into it) gets overwritten.
>
> Replace the loop body with the following and it should work:
>
> 	buffer ~= split(line.dup, "\t");
>
>
> T

Thank you so much for your explanation.
Helped me a lot to understand things and works actually :-)
LL


More information about the Digitalmars-d-learn mailing list