1 // (C) Copyright John Maddock 2005. 2 // Use, modification and distribution are subject to the 3 // Boost Software License, Version 1.0. (See accompanying file 4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #ifndef BOOST_TR1_MEMORY_HPP_INCLUDED 7 # define BOOST_TR1_MEMORY_HPP_INCLUDED 8 # include <boost/tr1/detail/config.hpp> 9 # include <boost/detail/workaround.hpp> 10 # include <memory> 11 12 #ifndef BOOST_HAS_TR1_SHARED_PTR 13 14 // 15 // This header can get included by boost/shared_ptr.hpp which leads 16 // to cyclic dependencies, the workaround is to forward declare all 17 // the boost components, and then include the actual headers afterwards. 18 // This is fragile, but seems to work, and doesn't require modification 19 // of boost/shared_ptr.hpp. 20 // 21 namespace boost{ 22 23 class bad_weak_ptr; 24 template<class T> class weak_ptr; 25 template<class T> class shared_ptr; 26 template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_NOEXCEPT; 27 template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) BOOST_NOEXCEPT; 28 template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; 29 template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; 30 template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) BOOST_NOEXCEPT; 31 template<class D, class T> D * get_deleter(shared_ptr<T> const & p) BOOST_NOEXCEPT; 32 template<class T> class enable_shared_from_this; 33 34 namespace detail{ 35 class shared_count; 36 class weak_count; 37 } 38 39 } 40 41 namespace std{ namespace tr1{ 42 43 using ::boost::bad_weak_ptr; 44 using ::boost::shared_ptr; 45 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) 46 using ::boost::swap; 47 #endif 48 using ::boost::static_pointer_cast; 49 using ::boost::dynamic_pointer_cast; 50 using ::boost::const_pointer_cast; 51 using ::boost::get_deleter; 52 using ::boost::weak_ptr; 53 using ::boost::enable_shared_from_this; 54 55 } } 56 #include <boost/shared_ptr.hpp> 57 #include <boost/weak_ptr.hpp> 58 #include <boost/enable_shared_from_this.hpp> 59 60 #else 61 62 # if defined(BOOST_HAS_INCLUDE_NEXT) && !defined(BOOST_TR1_DISABLE_INCLUDE_NEXT) 63 # include_next BOOST_TR1_HEADER(memory) 64 # else 65 # include <boost/tr1/detail/config_all.hpp> 66 # include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(memory)) 67 # endif 68 69 #endif 70 71 #endif 72 73