Printing a range of ranges drains them

monkyyy crazymonkyyy at gmail.com
Tue May 28 16:23:55 UTC 2024


On Tuesday, 28 May 2024 at 05:54:36 UTC, Salih Dincer wrote:
> On Monday, 27 May 2024 at 16:28:28 UTC, monkyyy wrote:
>> On Monday, 27 May 2024 at 00:25:42 UTC, Steven Schveighoffer 
>> wrote:
>>> 
>>> So, does anyone expect this behavior? If so, can you explain 
>>> why you think this is intentionally designed this way?
>>
>> This is correct behavior for ref front ranges with imperative 
>> pop
>
> Is the situation the same as this example?

I think so, should sorting fail if you use pointers rather then 
ref?

When writing generic code a ref range and a pointer to a range 
probably isnt different(given pointer flattening on argument 
call); maybe theres some edge case thats detectable but like I 
would never write it and its probably incorrect for other pointers

consumption and mutability is part of the range spec, and has to 
be for file io/sorting to work with the current goals.

So a mutable reference to a consuming range; will drain unless 
something else prevents it


More information about the Digitalmars-d mailing list