On 08/19/2017 08:49 PM, Jonathan Wakely wrote:
On 19 August 2017 at 18:02, Avi Kivity wrote:
I noticed that std::deque's move constructor (gcc 7.1) is not noexcept. Is
this conformant to the standard?
Yes it's conforming, but it sucks.
:(
It's hard to imagine a reasonable deque
implementation that can fail a move.
We have one. Our implementation is never "empty" it always has a table
of pointers even if there are no elements. That means we need to
allocate a new table for the moved-from deque, and allocating can
throw.
I don't think we can change this in an ABI compatible way.
Oh, I assumed no one would do this and wrote a wrapper that just adds
the noexcept, without even checking (a type that uses it requires
noexcept moves).
I guess it's unique_ptr time for me.