samedi 2 juillet 2016

Why is `boost::container::flat_set` not `nothrow_move_constructible`?

I was writing some code that has a generic container that requires elements to be nothrow_move_constructible.

I decided to add a static_assert that enforces this, just in case.

To my surprise I can't compile now when using boost::container::flat_set.

I assumed that this was just an oversight and I need a more recent boost verison, but it seems that actually they deliberately made it not safely movable:

See docs here:

http://ift.tt/29niFnK

You can see that they did update it to use R-value references and marked swap as noexcept, but they chose not to make the move ctor noexcept. It appears that move assignment is conditionally noexcept.

What could be the rationale for that? Is it just an oversight?

Aucun commentaire:

Enregistrer un commentaire