Ranges: is it ok if front is a data member?

Adam D. Ruppe destructionator at gmail.com
Thu Dec 12 09:00:39 PST 2013


On Thursday, 12 December 2013 at 16:45:05 UTC, H. S. Teoh wrote:
> I do this with my own ranges sometimes. Sometimes, it's more 
> performant to precompute the value of .front and store it (as 
> .front)

Yeah, that's exactly what I was doing here.

My question was mostly on if there's the chance that someone will 
call front() but looks like that isn't supposed to happen and is 
wrong if it does, so cool.


More information about the Digitalmars-d-learn mailing list