diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index 03e3800..8c2a977 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -60,10 +60,12 @@ public: // It is not possible to avoid spurious access violations since // in multithreaded programs r.px may be invalidated at any point. // -// A weak_ptr can safely be obtained from a weak_ptr by using -// -// weak_ptr wpt = make_shared(wpu); -// + + template + weak_ptr(weak_ptr const & r): pn(r.pn) // never throws + { + px = boost::make_shared(r).get(); + } template weak_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws @@ -72,6 +74,14 @@ public: #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) + template + weak_ptr & operator=(weak_ptr const & r) // never throws + { + px = boost::make_shared(r).get(); + pn = r.pn; + return *this; + } + template weak_ptr & operator=(shared_ptr const & r) // never throws {