Why does std::vector copy-construct instead of move-construct when the destructor may throw?

This is LWG2116. The choice between moving and copying the elements is often expressed as std::is_nothrow_move_constructible, i.e. noexcept(T(T&&)), which also erroneously checks the destructor.

Leave a Comment