1 #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED
2 #define BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED
4 // enable_shared_from.hpp
6 // Copyright 2019, 2020 Peter Dimov
8 // Distributed under the Boost Software License, Version 1.0.
9 // See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt
12 // See http://www.boost.org/libs/smart_ptr/ for documentation.
14 #include <boost/smart_ptr/enable_shared_from_this.hpp>
15 #include <boost/smart_ptr/detail/sp_noexcept.hpp>
20 class enable_shared_from: public enable_shared_from_this<enable_shared_from>
24 using enable_shared_from_this<enable_shared_from>::shared_from_this;
25 using enable_shared_from_this<enable_shared_from>::weak_from_this;
29 template<class T> shared_ptr<T> shared_from( T * p )
31 return shared_ptr<T>( p->enable_shared_from_this<enable_shared_from>::shared_from_this(), p );
34 template<class T> weak_ptr<T> weak_from( T * p ) BOOST_SP_NOEXCEPT
36 return weak_ptr<T>( p->enable_shared_from_this<enable_shared_from>::weak_from_this(), p );
41 #endif // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED