Motive behind !empty() with front() instead of Optional front()

Per Nordlöw per.nordlow at gmail.com
Fri Mar 26 16:04:03 UTC 2021


On Friday, 26 March 2021 at 15:53:39 UTC, Steven Schveighoffer 
wrote:
> ...
> I would support a new kind of range that uses `Optional!T 
> next()` as its API. I would not support `Optional!T front(); 
> void popFront()`.

Interesting.

For reference, note that Rust also has

https://doc.rust-lang.org/std/iter/struct.Peekable.html

alongside

https://doc.rust-lang.org/core/iter/trait.Iterator.html


More information about the Digitalmars-d mailing list