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

Per Nordlöw per.nordlow at gmail.com
Wed Mar 24 21:20:40 UTC 2021


On Wednesday, 24 March 2021 at 21:09:52 UTC, IGotD- wrote:
> For example in a loop and you know the amount of elements in 
> advance then the check is unnecessary.

Are you talking about a foreach loop? If so, the element type 
will never have to be an optional type. Regardless of whether 
`front` is wrapped in an Optional or not.


More information about the Digitalmars-d mailing list