diff options
Diffstat (limited to 'boost/ptr_container/ptr_map_adapter.hpp')
-rw-r--r-- | boost/ptr_container/ptr_map_adapter.hpp | 112 |
1 files changed, 108 insertions, 4 deletions
diff --git a/boost/ptr_container/ptr_map_adapter.hpp b/boost/ptr_container/ptr_map_adapter.hpp index 4754a94977..04caf8706a 100644 --- a/boost/ptr_container/ptr_map_adapter.hpp +++ b/boost/ptr_container/ptr_map_adapter.hpp @@ -19,9 +19,15 @@ #include <boost/ptr_container/detail/map_iterator.hpp> #include <boost/ptr_container/detail/associative_ptr_container.hpp> #include <boost/ptr_container/detail/meta_functions.hpp> +#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp> #include <boost/static_assert.hpp> #include <boost/range/iterator_range.hpp> +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + namespace boost { namespace ptr_container_detail @@ -259,17 +265,32 @@ namespace ptr_container_detail : base_type( first, last, hash, pred, a ) { } +#ifndef BOOST_NO_AUTO_PTR template< class PtrContainer > - explicit ptr_map_adapter_base( std::auto_ptr<PtrContainer> clone ) + explicit ptr_map_adapter_base( std::auto_ptr<PtrContainer> clone ) : base_type( clone ) { } - + template< typename PtrContainer > - ptr_map_adapter_base& operator=( std::auto_ptr<PtrContainer> clone ) + ptr_map_adapter_base& operator=( std::auto_ptr<PtrContainer> clone ) { base_type::operator=( clone ); return *this; } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class PtrContainer > + explicit ptr_map_adapter_base( std::unique_ptr<PtrContainer> clone ) + : base_type( std::move( clone ) ) + { } + + template< typename PtrContainer > + ptr_map_adapter_base& operator=( std::unique_ptr<PtrContainer> clone ) + { + base_type::operator=( std::move( clone ) ); + return *this; + } +#endif iterator find( const key_type& x ) { @@ -353,11 +374,20 @@ namespace ptr_container_detail return boost::ptr_container::move( old ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > auto_type replace( iterator where, std::auto_ptr<U> x ) { return replace( where, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + auto_type replace( iterator where, std::unique_ptr<U> x ) + { + return replace( where, x.release() ); + } +#endif protected: size_type bucket( const key_type& key ) const @@ -488,9 +518,16 @@ namespace ptr_container_detail map_basic_clone_and_insert( r.begin(), r.end() ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > ptr_map_adapter( std::auto_ptr<U> r ) : base_type( r ) { } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + ptr_map_adapter( std::unique_ptr<U> r ) : base_type( std::move( r ) ) + { } +#endif ptr_map_adapter& operator=( ptr_map_adapter r ) { @@ -498,12 +535,22 @@ namespace ptr_container_detail return *this; } +#ifndef BOOST_NO_AUTO_PTR template< class U > ptr_map_adapter& operator=( std::auto_ptr<U> r ) - { + { base_type::operator=( r ); return *this; } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + ptr_map_adapter& operator=( std::unique_ptr<U> r ) + { + base_type::operator=( std::move( r ) ); + return *this; + } +#endif using base_type::release; @@ -552,11 +599,20 @@ namespace ptr_container_detail return insert_impl( key, x ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > std::pair<iterator,bool> insert( const key_type& key, std::auto_ptr<U> x ) { return insert_impl( key, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + std::pair<iterator,bool> insert( const key_type& key, std::unique_ptr<U> x ) + { + return insert_impl( key, x.release() ); + } +#endif template< class F, class S > iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong @@ -579,11 +635,20 @@ namespace ptr_container_detail return insert_impl( before, key, x ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong { return insert_impl( before, key, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + iterator insert( iterator before, const key_type& key, std::unique_ptr<U> x ) // strong + { + return insert_impl( before, key, x.release() ); + } +#endif template< class PtrMapAdapter > bool transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object, @@ -738,9 +803,16 @@ namespace ptr_container_detail map_basic_clone_and_insert( r.begin(), r.end() ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > explicit ptr_multimap_adapter( std::auto_ptr<U> r ) : base_type( r ) { } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + explicit ptr_multimap_adapter( std::unique_ptr<U> r ) : base_type( std::move( r ) ) + { } +#endif ptr_multimap_adapter& operator=( ptr_multimap_adapter r ) { @@ -748,12 +820,22 @@ namespace ptr_container_detail return *this; } +#ifndef BOOST_NO_AUTO_PTR template< class U > ptr_multimap_adapter& operator=( std::auto_ptr<U> r ) { base_type::operator=( r ); return *this; } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + ptr_multimap_adapter& operator=( std::unique_ptr<U> r ) + { + base_type::operator=( std::move( r ) ); + return *this; + } +#endif using base_type::release; @@ -803,11 +885,20 @@ namespace ptr_container_detail return insert_impl( key, x ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > iterator insert( const key_type& key, std::auto_ptr<U> x ) { return insert_impl( key, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + iterator insert( const key_type& key, std::unique_ptr<U> x ) + { + return insert_impl( key, x.release() ); + } +#endif template< class F, class S > iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong @@ -824,11 +915,20 @@ namespace ptr_container_detail return insert_impl( before, key, x ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong { return insert_impl( before, key, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + iterator insert( iterator before, const key_type& key, std::unique_ptr<U> x ) // strong + { + return insert_impl( before, key, x.release() ); + } +#endif template< class PtrMapAdapter > void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object, @@ -875,4 +975,8 @@ namespace ptr_container_detail } // namespace 'boost' +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic pop +#endif + #endif |