Range Redesign: Copy Semantics
Atila Neves
atila.neves at gmail.com
Tue Jan 23 09:19:24 UTC 2024
On Monday, 22 January 2024 at 17:07:05 UTC, H. S. Teoh wrote:
> On Mon, Jan 22, 2024 at 03:41:35PM +0000, Atila Neves via
> Digitalmars-d wrote:
>> On Sunday, 21 January 2024 at 05:00:31 UTC, Jonathan M Davis
>> wrote:
>> > [...]
>>
>> I don't think I've ever encountered a situation where
>> reference ranges would have been desirable - I've never used
>> one.
>
> It's useful in recursive-descent parsers where you expect the
> range to have advanced past whatever a recursive call has
> consumed.
Why can't this be done with value ranges?
>> I think that `.save` was a historical mistake, and that ranges
>> that can be copied are forward ranges. Something like a range
>> reading from stdin or a socket would/should disable the
>> copy/postblit constructors.
>
> Meaning they can only be passed by reference?
Or moved.
More information about the Digitalmars-d
mailing list