See More

#include #include int main() { std::shared_ptr mySharedPtr(new int); std::cout << "shared pointer count = " << mySharedPtr.use_count() << std::endl; std::weak_ptr myWeakPtr1(mySharedPtr); std::weak_ptr myWeakPtr2(myWeakPtr1); std::cout << "shared pointer count = " << mySharedPtr.use_count() << std::endl; std::weak_ptr myWeakPtr3(new int); // COMPILE ERROR return 0; }