1 --- shared_ptr.hpp.orig 2016-11-12 13:46:50.000000000 -0500
2 +++ shared_ptr.hpp 2018-12-19 10:33:00.022538689 -0500
4 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
7 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
8 +void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
9 +void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
10 +void boost_debug_shared_ptr_destructor (void const *, volatile void const *, int);
11 +void boost_debug_shared_ptr_constructor (void const *, volatile void const *, int);
19 boost::detail::shared_count( p ).swap( pn );
20 boost::detail::sp_enable_shared_from_this( ppx, p, p );
21 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
22 + boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
26 #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
28 -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
29 +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * ppx, Y * p, boost::detail::shared_count & pn )
31 sp_assert_convertible< Y[], T[] >();
32 boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
33 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
34 + /* no code for this yet - shared_ptr to array of T */
38 template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
40 sp_assert_convertible< Y[N], T[N] >();
41 boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
42 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
43 + /* no code for this yet - shared_ptr to array of T */
47 #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
49 template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p )
51 boost::detail::sp_enable_shared_from_this( ppx, p, p );
52 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
53 + boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
57 #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
59 template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ )
61 sp_assert_convertible< Y[], T[] >();
62 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
63 + /* no code for this yet - shared_ptr to array of T */
67 template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ )
69 sp_assert_convertible< Y[N], T[N] >();
70 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
71 + /* no code for this yet - shared_ptr to array of T */
75 #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
78 shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
80 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
81 + /* default constructor case */
82 + boost_debug_shared_ptr_constructor (this, px, use_count());
86 #if !defined( BOOST_NO_CXX11_NULLPTR )
88 shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
90 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
91 + /* explicit nullptr constructor case */
92 + boost_debug_shared_ptr_constructor (this, px, use_count());
99 template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
101 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
102 + boost_debug_shared_ptr_constructor (this, px, use_count());
108 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
110 + boost_debug_shared_ptr_destructor (this, get(), use_count());
113 // generated copy constructor, destructor are fine...
114 +#endif /* BOOST_SP_ENABLE_DEBUG_HOOKS */
116 #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
120 shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
122 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
123 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
130 boost::detail::sp_assert_convertible< Y, T >();
132 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
133 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
135 // it is now safe to copy r.px, as pn(r.pn) did not throw
142 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
143 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
149 BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
151 boost::detail::sp_assert_convertible< Y, T >();
152 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
153 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
160 shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
162 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
163 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
165 this_type(r).swap(*this);
170 shared_ptr & operator=( std::auto_ptr<Y> & r )
172 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
173 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
175 this_type( r ).swap( *this );
180 shared_ptr & operator=( std::auto_ptr<Y> && r )
182 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
183 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
185 this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
189 template<class Y, class D>
190 shared_ptr & operator=( std::unique_ptr<Y, D> && r )
192 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
193 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
195 this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
200 shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
202 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
203 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
208 @@ -625,12 +694,18 @@
210 boost::detail::sp_assert_convertible< Y, T >();
212 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
213 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
219 shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
221 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
222 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
224 this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
229 shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
231 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
232 + boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
234 this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
239 shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
241 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
242 + boost_debug_shared_ptr_operator_reset (this, get(), use_count(), 0, 0);
244 this_type().swap(*this);
247 @@ -664,27 +745,42 @@
249 void reset() BOOST_NOEXCEPT // never throws in 1.30+
251 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
252 + boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
254 this_type().swap(*this);
257 template<class Y> void reset( Y * p ) // Y must be complete
259 BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
260 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
261 + boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
263 this_type( p ).swap( *this );
266 template<class Y, class D> void reset( Y * p, D d )
268 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
269 + boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
271 this_type( p, d ).swap( *this );
274 template<class Y, class D, class A> void reset( Y * p, D d, A a )
276 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
277 + boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
279 this_type( p, d, a ).swap( *this );
282 template<class Y> void reset( shared_ptr<Y> const & r, element_type * p )
284 +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
285 + boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
287 this_type( r, p ).swap( *this );