Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Why should move constructors be marked noexcept?

  1. A It is required by the standard
  2. B std::vector only uses the move constructor during reallocation if it is noexcept
  3. C It makes the move faster
  4. D It prevents exceptions being thrown anywhere in the class
Answer

std::vector only uses the move constructor during reallocation if it is noexcept

Without noexcept, vector copies instead of moving in order to preserve the strong exception guarantee, silently losing the performance benefit.

All C++ MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as