Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++shared_ptr and weak_ptrSingle-choice MCQ

What is the value of count after this sequence, and why?

auto sp = std::make_shared<int>(5); std::weak_ptr<int> wp = sp; long count = sp.use_count(); std::shared_ptr<int> sp2 = wp.lock();