writeln wipes contents of variables ?

W.J. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 16:49:09 PST 2016


On Thursday, 21 January 2016 at 21:59:10 UTC, Chris Wright wrote:
> On Thu, 21 Jan 2016 14:07:16 +0000, W.J. wrote:
>> So writeln consumes the values in an InputRange. That leads me 
>> to
>> believe that if I feed an InputRange to foreach, it will 
>> consume the
>> values, too.
>> Did I get that right ?
>
> In general, yes.
>

Thanks for your reply.

> Some ranges have value semantics and can be saved simply by 
> assigning them to a new variable, or passing them to a function.

How can I identify those ranges, or, how can I tell if any 
particular range has value semantics ? I didn't read any of this 
in the manual - not that I could remember anyways.

Thanks for your help!


More information about the Digitalmars-d-learn mailing list