opNext: Simplified ranges

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Nov 10 16:11:31 UTC 2022


On Thursday, 10 November 2022 at 15:25:30 UTC, Joseph Rushton 
Wakeling wrote:
> Other possibilities, such as the presence of a check whether 
> the range is `empty`, or the possibility to `peek`, would then 
> be less information-limited options on top of that.

BTW, note that the `empty` check is a more information-limited 
version of peekability.  For example, an algorithmic range (such 
as a range-based view of random number generation) can tell you 
that it's not empty, but may not be able to tell you what the 
next value will be.

OTOH I would imagine that most (all?) ranges across the contents 
of containers should be able both to tell you if the range is 
empty or not _and_ allow you to peek at the next in sequence.


More information about the Digitalmars-d mailing list