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

What problem does std::weak_ptr solve?

  1. A Slow allocation
  2. B Reference cycles between shared_ptr objects that would otherwise never be destroyed
  3. C Thread safety
  4. D Alignment requirements
Answer

Reference cycles between shared_ptr objects that would otherwise never be destroyed

Two objects holding shared_ptr to each other keep their counts above zero forever. A weak_ptr observes without owning, breaking the cycle.

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