on-internet
← Community

Why does a throwing move constructor result in copying instead of moving where a strong exception guarantee is given?

Stack Overflow ·

Everywhere I look it seems to be the agreement that the standard library must call copy constructors instead of move constructors when the move constructor is noexcept(false). Now I do not understand why this is the case. And furthermore, Visual Studio VC v140 and gcc v 4.9.2 seems to do this differently. I do not understand why noexcept this is a concern of e.g. vector<T>. I mean, how should vector<T>::resize() be able to give strong exception guarantee if T does not? As I see it, the exception level of vector will be dependent on T, regardless if copy or move is used. I understand noexcept t

Comments

Sign in or sign up to comment and upvote.

No comments yet.