What problem does std::weak_ptr solve?
- A Slow allocation
- B Reference cycles between shared_ptr objects that would otherwise never be destroyed
- C Thread safety
- 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.





