Proposal: takeFront and takeBack

Roman D. Boiko rb at d-coding.com
Wed Jul 4 01:25:58 PDT 2012


On Wednesday, 4 July 2012 at 08:20:59 UTC, Mehrdad wrote:
> I propose we just allow (but not require) popFront() to return 
> ElementType!(R) instead of void?
>
> That way, people who need the performance can check to see the 
> return type, and use it without front() if needed.

That would be almost perfect. But has drawbacks:

* if element is big and may be not needed in all calls to 
popFront (when the user wants to ignore elements), there would be 
some overhead;

* it might be impossible to change some ranges which would work 
with current design; I'm not aware of such cases, though

* something else?


More information about the Digitalmars-d mailing list