// Copyright Frank Mori Hess 2009. // Distributed under the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_SHARED_FROM_THIS #define BOOST_SHARED_FROM_THIS #include #include namespace boost { template shared_ptr shared_from_this(T *p); class enable_shared_from_this_base: private enable_shared_from_this { template friend boost::shared_ptr shared_from_this(T *p); template friend class boost::shared_ptr; friend class enable_shared_from_this; }; template shared_ptr shared_from_this(T *p) { return shared_ptr(p->shared_from_this(), p); } } #endif // BOOST_SHARED_FROM_THIS