Proposal: takeFront and takeBack

Mehrdad wfunction at hotmail.com
Wed Jul 4 01:37:41 PDT 2012


On Wednesday, 4 July 2012 at 08:35:30 UTC, Dmitry Olshansky wrote:
> On 04-Jul-12 12:29, Mehrdad wrote:
>> On Wednesday, 4 July 2012 at 08:25:59 UTC, Roman D. Boiko 
>> wrote:
>>> 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;
>>
>> Could you give an example of such a range? Does such a 
>> heavyweight range
>> come up in practice? (I'm assuming RVO would take care of not 
>> calling
>> copy constructors and such.)
>>
>
> UTF strings - calculating length of codepoint is cheaper then 
> actually decoding it and then throwing away.

No, I think you misunderstood my question. I definitely know the 
use case for /that/.
I was talking about an example of what I replied to, i.e. where 
Roman said the "element is big". dchars aren't big.


More information about the Digitalmars-d mailing list