diff --git a/include/boost/enable_shared_from_this.hpp b/include/boost/enable_shared_from_this.hpp index 199725a..ae5d809 100644 --- a/include/boost/enable_shared_from_this.hpp +++ b/include/boost/enable_shared_from_this.hpp @@ -14,9 +14,10 @@ // http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html // -#include -#include #include +#include +#include +#include namespace boost { @@ -27,12 +28,16 @@ public: shared_ptr shared_from_this() { - return shared_ptr(weak_this); + shared_ptr p(weak_this); + BOOST_ASSERT(p.get() == this); + return p; } shared_ptr shared_from_this() const { - return shared_ptr(weak_this); + shared_ptr p(weak_this); + BOOST_ASSERT(p.get() == this); + return p; } #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS @@ -43,7 +48,8 @@ private: #endif - weak_ptr weak_this; + typedef T element_type; // for bcc 5.5.1 + weak_ptr weak_this; }; } // namespace boost