Proposal: takeFront and takeBack

Mehrdad wfunction at hotmail.com
Wed Jul 4 01:35:07 PDT 2012


On Wednesday, 4 July 2012 at 08:31:05 UTC, Jonathan M Davis wrote:
> He was suggesting that a range like ByLine define consumeFront 
> and then play games to make it work. So, instead of doing the 
> equivalent of
>
> auto retval = range.front;
> range.popFront();
> return retval;
>
> only more efficiently, it would be trying to save state to make 
> the front that it returned still be valid, when in ranges like 
> ByLine, it's not, because the buffer that front returns is 
> reused.


Oh I see, now I see the issue, thanks.


I'm not sure though, is the lack of a reusable buffer really a 
problem? I mean, at the worst case it's 1 extra copy of the data, 
which shouldn't really be too bad... has this actually been a 
performance bottleneck for anyone?


More information about the Digitalmars-d mailing list