From 9db927c2df1c8d17c90b2217971c3115cf23009b Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Fri, 5 May 2017 15:54:31 +0200 Subject: [PATCH] Replace deprecated/removed auto_ptr by unique_ptr. Signed-off-by: Daniela Engert --- include/boost/assign/ptr_list_of.hpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/boost/assign/ptr_list_of.hpp b/include/boost/assign/ptr_list_of.hpp index 0ea6cd2..082f372 100644 --- a/include/boost/assign/ptr_list_of.hpp +++ b/include/boost/assign/ptr_list_of.hpp @@ -47,7 +47,11 @@ namespace assign_detail { protected: typedef boost::ptr_vector impl_type; +#if defined(BOOST_NO_AUTO_PTR) + typedef std::unique_ptr release_type; +#else typedef std::auto_ptr release_type; +#endif mutable impl_type values_; public: @@ -92,9 +96,18 @@ namespace assign_detail } template< class PtrContainer > - std::auto_ptr convert( const PtrContainer* c ) const +#if defined(BOOST_NO_AUTO_PTR) + std::unique_ptr +#else + std::auto_ptr +#endif + convert( const PtrContainer* c ) const { +#if defined(BOOST_NO_AUTO_PTR) + std::unique_ptr res( new PtrContainer() ); +#else std::auto_ptr res( new PtrContainer() ); +#endif while( !empty() ) res->insert( res->end(), values_.pop_back().release() ); @@ -102,7 +115,12 @@ namespace assign_detail } template< class PtrContainer > - std::auto_ptr to_container( const PtrContainer& c ) const +#if defined(BOOST_NO_AUTO_PTR) + std::unique_ptr +#else + std::auto_ptr +#endif + to_container( const PtrContainer& c ) const { return convert( &c ); }