state of ranges

ag0aep6g anonymous at example.com
Wed Dec 13 10:15:10 UTC 2017


On 12/13/2017 10:13 AM, Dukc wrote:
> front() can assume that 
> something can be found, so it may as well fetch the value without 
> checking and rely on built-in array bounds checking and null behaviour 
> for memory safety. empty() is the one which should check those things 
> manually.

No. As Seb has quoted, `front` can't assume that `empty` has been called 
before. For a well-behaved range, `front` must work the same whether 
you've called `empty` or not (given that the range isn't actually empty).


More information about the Digitalmars-d mailing list