Idiomatic way to write a range that tracks how much it consumes

Jon Degenhardt jond at noreply.com
Mon Apr 27 05:45:26 UTC 2020


On Monday, 27 April 2020 at 04:41:58 UTC, drug wrote:
> 27.04.2020 06:38, Jon Degenhardt пишет:
>> 
>> Is there a better way to write this?
>> 
>> --Jon
>
> I don't know a better way, I think you enlist all possible ways 
> - get a value using either `front` or special range member. I 
> prefer the second variant, I don't think it is less consistent 
> with range paradigms. Considering you need amount of consumed 
> bytes only when range is empty the second way is more effective.

Thanks. Of two, I like the second better as well.


More information about the Digitalmars-d-learn mailing list