foreach() behavior on ranges
Steven Schveighoffer
schveiguy at gmail.com
Wed Aug 25 11:04:35 UTC 2021
On 8/25/21 6:06 AM, Alexandru Ermicioi wrote:
> On Wednesday, 25 August 2021 at 08:15:18 UTC, frame wrote:
>> I know, but foreach() doesn't call save().
>
> Hmm, this is a regression probably, or I missed the time frame when
> foreach moved to use of copy constructor for forward ranges.
>
> Do we have a well defined description of what input, forward and any
> other well known range is, and how it does interact with language features?
>
> For some reason I didn't manage to find anything on dlang.org.
It never has called `save`. It makes a copy, which is almost always the
equivalent `save` implementation.
-Steve
More information about the Digitalmars-d-learn
mailing list