Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:50

0001 #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED
0002 #define BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED
0003 
0004 //  enable_shared_from.hpp
0005 //
0006 //  Copyright 2019, 2020 Peter Dimov
0007 //
0008 //  Distributed under the Boost Software License, Version 1.0.
0009 //  See accompanying file LICENSE_1_0.txt or copy at
0010 //  http://www.boost.org/LICENSE_1_0.txt
0011 //
0012 //  See http://www.boost.org/libs/smart_ptr/ for documentation.
0013 
0014 #include <boost/smart_ptr/enable_shared_from_this.hpp>
0015 
0016 namespace boost
0017 {
0018 
0019 class enable_shared_from: public enable_shared_from_this<enable_shared_from>
0020 {
0021 private:
0022 
0023     using enable_shared_from_this<enable_shared_from>::shared_from_this;
0024     using enable_shared_from_this<enable_shared_from>::weak_from_this;
0025 };
0026 
0027 
0028 template<class T> shared_ptr<T> shared_from( T * p )
0029 {
0030     return shared_ptr<T>( p->enable_shared_from_this<enable_shared_from>::shared_from_this(), p );
0031 }
0032 
0033 template<class T> weak_ptr<T> weak_from( T * p ) noexcept
0034 {
0035     return weak_ptr<T>( p->enable_shared_from_this<enable_shared_from>::weak_from_this(), p );
0036 }
0037 
0038 } // namespace boost
0039 
0040 #endif  // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_HPP_INCLUDED