Boost logo

Boost :

Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
From: Tim Song (t.canens.cpp_at_[hidden])
Date: 2017-09-27 19:39:34


On Wed, Sep 27, 2017 at 2:20 PM, Thorsten Ottosen via Boost
<boost_at_[hidden]> wrote:
>
>>>> I'm somewhat surprised that dropping the move_if_noexcept/strong
>>>> exception safety dance doesn't seem to have been considered for a
>>>> container that's supposed to be performance-oriented.
>>>
>>>
>>>
>>> For which container operation are you thinking about?
>>
>>
>> Anything that reallocates, really. Basically, unconditionally move
>> during reallocation instead of move_if_noexcept, and if the move
>> throws you only get basic exception safety.
>
>
> Does Boost.Container do this? Would it not make generic code harder to
> reason about?

I haven't checked, but I'd be surprised if boost::container::vector
offers less exception safety than std::vector, even if the stronger
exception safety is arguably a design error that had to be retained
for backward compatibility. There is, however, no standard container
named "devector", so there might be some room for change there.

Anyway, my main point, which I perhaps didn't express too well, is
that "introduce unsafe functions to save a branch" and "have no way to
avoid expensive copies if the move constructor can potentially throw"
are inconsistent.


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