Boost logo

Boost :

Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2017-10-05 20:58:16


On 05/10/2017 9:04, Benedek Thaler via Boost wrote:
>> 5) reserve() / resize(): I think they have no sensible meaning in the
>> container (capacity() could be useful, depending on the reallocation
>> strategy). We should not treat back insertion as the “default” insertion.
>> IMHO the API of devector should be symmetrical.
>>
>
> Again, compatibility.

Understood.

> s/unsafe/unchecked, agreed. Also, we need the emplace methods as well.

Why both? Isn't emplace enough?

> Reallocation strategy: First, I considered this strategyunnatural, but now
>> I am not sure. For a push_front, if no free front capacity is found, but
>> there is free back capacity, then all data is shifted to insert the
>> element. If interleaved front and back insertions are performed, I don’t
>> know if this will lead to too many data movements. [snip]
>>
>
> If it does not shift, it has to reallocate - and then copy/move everything
> over. I don't see how is that any better.

Yes, this is tricky, as I pointed out in other reply to Thorsten, we
could maybe move elements in bigger steps to avoid quadratic behavior
with repeated inserts in one end while buffer is being reallocated.

> The interest of the community should be put first. If we think adding
> pieces to Container would improve situations, we should find a way. On the
> other hand, I wouldn't love to port code to C++03, for two reasons: It is a
> soul crushing work, and, we should not encourage writing new code using old
> standards (I know, there's no other option in certain cases.).

Yes. I know will be the last warrior supporting C++03 in Boost ;-)

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk