DList.Range magically becomes empty.

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 26 08:07:11 PST 2015


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.


More information about the Digitalmars-d-learn mailing list