Listing 2
// synopsis of template class weak_ptr template <class Ty> class weak_ptr { public: typedef Ty element_type; weak_ptr(); weak_ptr(const weak_ptr& wp); template<class Other> weak_ptr(const weak_ptr<Other>& wp); template<class Other> weak_ptr(const shared_ptr<Other>& sp); weak_ptr& operator=(const weak_ptr& sp); template<class Other> weak_ptr& operator=(const weak_ptr<Other>& sp); template<class Other> weak_ptr& operator=(const shared_ptr<Other>& ap); void swap(weak_ptr& sp); void reset(); long use_count() const; bool expired() const; shared_ptr<Ty> lock() const; };