Range Redesign: Copy Semantics

Paul Backus snarwin at gmail.com
Mon Jan 22 02:30:40 UTC 2024


On Monday, 22 January 2024 at 02:10:32 UTC, Jonathan M Davis 
wrote:
> On Sunday, January 21, 2024 7:51:33 AM MST Paul Backus via 
> Digitalmars-d wrote:
>> With the proposed design, it would be possible to implement 
>> next() for forward ranges as a UFCS function:
[...]
>
> True, but then you have a function with the same copy semantics 
> problem that we have now, since the forward range wouldn't have 
> reference semantics. It would need to be fully wrapped in 
> another type which gave it reference semantics to do that.

You caught me--I forgot to mark the parameter as 'ref'. Dangers 
of writing code directly into a message without testing it first, 
I suppose. :)


More information about the Digitalmars-d mailing list