On 2/26/15 11:07 AM, Tobias Pankrath wrote:
On Thursday, 26 February 2015 at 15:57:22 UTC, Steven Schveighoffer wrote:
On 2/25/15 4:58 AM, Ivan Timokhin wrote:
Tobias Pankrath wrote:
writefln("stack: %s", stack[]); //fine
This call consumes all ranges stored in stack, so they're empty
afterwards.
This has to be a bug. stack[] should produce a range that can be
iterated without destroying the data in the container. If it doesn't,
it should be supported.
-Steve
Haven't looked into it, but I'd rather say that writefln (or
formattedWrite, or what is used) should only take ranges per ref, if
they cannot be copied and cannot be saved.
OK, this is more complex than I thought. Both stack[] and list[] are
providing copies.
I mistakenly thought that because stack prints empty that the list has
been emptied. It hasn't, just the ranges are emptied.
Yes, I agree, it's writefln that should be fixed here.
-Steve