Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12319 closed Bugs (fixed)

`boost::container::flat_set` should be nothrow move constructible

Reported by: beck.ct@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

It appears to me that in a simple oversight, boost::container::flat_set is missing a noexcept declaration on its move constructor.

It is conditionally noexcept move assignable, assuming there are no allocator shenanigans. I'm not aware of a reason why something would be sometimes noexcept move assignable, but never move constructible.

It appears to me that the implementation in fact does not throw, so I *believe* this could be fixed quite easily.

It would help using this type with generic code in certain cases if it were marked thusly. Thank you.

(I earlier posted this on stackoverflow here:

http://stackoverflow.com/questions/38166063/why-is-boostcontainerflat-set-not-nothrow-move-constructible

)

Change History (2)

comment:1 by Ion Gaztañaga, 6 years ago

Resolution: fixed
Status: newclosed

Thanks for the report. I've revised the standard and several STL implementations, and they all agree that associative containers' move constructor can't be unconditionally noexcept since they need to move construct the comparison predicate from the source container. However, they can be noexcept if the Compare's move constructor is noexcept. The commit:

https://github.com/boostorg/container/commit/225e2da77e65fa73a79b5acba1a8faf5e4abe25c

revises all default and move constructors and tries to better specify the minimum conditions to mark them as noexcept.

comment:2 by anonymous, 6 years ago

Cool, thank you

Note: See TracTickets for help on using tickets.