ext/boost/smart_ptr/shared_array.hpp in passenger-3.0.21 vs ext/boost/smart_ptr/shared_array.hpp in passenger-3.9.1.beta

- old
+ new

@@ -67,12 +67,30 @@ template<class D> shared_array(T * p, D d): px(p), pn(p, d) { } -// generated copy constructor, assignment, destructor are fine +// generated copy constructor, destructor are fine... +#if defined( BOOST_HAS_RVALUE_REFS ) + +// ... except in C++0x, move disables the implicit copy + + shared_array( shared_array const & r ): px( r.px ), pn( r.pn ) // never throws + { + } + +#endif + + // assignment + + shared_array & operator=( shared_array const & r ) // never throws + { + this_type( r ).swap( *this ); + return *this; + } + void reset(T * p = 0) { BOOST_ASSERT(p == 0 || p != px); this_type(p).swap(*this); } @@ -111,10 +129,15 @@ { std::swap(px, other.px); pn.swap(other.pn); } + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const + { + return pn.get_deleter( ti ); + } + private: T * px; // contained pointer detail::shared_count pn; // reference counter @@ -136,9 +159,14 @@ } template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws { a.swap(b); +} + +template< class D, class T > D * get_deleter( shared_array<T> const & p ) +{ + return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) ); } } // namespace boost #endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)