state of ranges

Dukc ajieskola at gmail.com
Wed Dec 13 09:13:20 UTC 2017


On Tuesday, 12 December 2017 at 23:43:19 UTC, Luís Marques wrote:
> Well, I was referring to things like in front() having to use 
> code such as `if(!inited) ...; return value

I think you only have to do that if you have some custom pointer 
arithmetic and you want to make sure it remains memory safe. 
However, in the general case you don't need to do that. 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.


More information about the Digitalmars-d mailing list