diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
commit | b8cf34c691623e4ec329053cbbf68522a855882d (patch) | |
tree | 34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/ptr_container/detail | |
parent | 3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff) | |
download | boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2 boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip |
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/ptr_container/detail')
3 files changed, 177 insertions, 13 deletions
diff --git a/boost/ptr_container/detail/associative_ptr_container.hpp b/boost/ptr_container/detail/associative_ptr_container.hpp index c2033fa39d..a170fb727d 100644 --- a/boost/ptr_container/detail/associative_ptr_container.hpp +++ b/boost/ptr_container/detail/associative_ptr_container.hpp @@ -18,6 +18,12 @@ #endif #include <boost/ptr_container/detail/reversible_ptr_container.hpp> +#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp> + +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif namespace boost { @@ -103,10 +109,18 @@ namespace ptr_container_detail : base_type( first, last, hash, pred, a ) { } +#ifndef BOOST_NO_AUTO_PTR template< class PtrContainer > explicit associative_ptr_container( std::auto_ptr<PtrContainer> r ) : base_type( r ) { } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class PtrContainer > + explicit associative_ptr_container( std::unique_ptr<PtrContainer> r ) + : base_type( std::move( r ) ) + { } +#endif associative_ptr_container( const associative_ptr_container& r ) : base_type( r.begin(), r.end(), container_type() ) @@ -117,12 +131,22 @@ namespace ptr_container_detail : base_type( r.begin(), r.end(), container_type() ) { } +#ifndef BOOST_NO_AUTO_PTR template< class PtrContainer > associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow { base_type::operator=( r ); return *this; } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class PtrContainer > + associative_ptr_container& operator=( std::unique_ptr<PtrContainer> r ) // nothrow + { + base_type::operator=( std::move( r ) ); + return *this; + } +#endif associative_ptr_container& operator=( associative_ptr_container r ) // strong { @@ -407,5 +431,8 @@ namespace ptr_container_detail } // namespace 'boost' +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic pop +#endif #endif diff --git a/boost/ptr_container/detail/ptr_container_disable_deprecated.hpp b/boost/ptr_container/detail/ptr_container_disable_deprecated.hpp new file mode 100644 index 0000000000..6aaa2c1629 --- /dev/null +++ b/boost/ptr_container/detail/ptr_container_disable_deprecated.hpp @@ -0,0 +1,40 @@ +#ifndef BOOST_PTR_CONTAINER_DETAIL_PTR_CONTAINER_DISABLE_DEPRECATED_HPP_INCLUDED +#define BOOST_PTR_CONTAINER_DETAIL_PTR_CONTAINER_DISABLE_DEPRECATED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/ptr_container/detail/ptr_container_disable_deprecated.hpp +// +// Copyright 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/config.hpp> + +#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) ) && !defined(BOOST_NO_AUTO_PTR) + +# if defined( BOOST_GCC ) + +# if BOOST_GCC >= 40600 +# define BOOST_PTR_CONTAINER_DISABLE_DEPRECATED +# endif + +# elif defined( __clang__ ) && defined( __has_warning ) + +# if __has_warning( "-Wdeprecated-declarations" ) +# define BOOST_PTR_CONTAINER_DISABLE_DEPRECATED +# endif + +# endif + +#endif + +#endif // #ifndef BOOST_PTR_CONTAINER_DETAIL_PTR_CONTAINER_DISABLE_DEPRECATED_HPP_INCLUDED diff --git a/boost/ptr_container/detail/reversible_ptr_container.hpp b/boost/ptr_container/detail/reversible_ptr_container.hpp index 930f468b6b..37cb9bb57b 100644 --- a/boost/ptr_container/detail/reversible_ptr_container.hpp +++ b/boost/ptr_container/detail/reversible_ptr_container.hpp @@ -20,6 +20,7 @@ #include <boost/ptr_container/detail/throw_exception.hpp> #include <boost/ptr_container/detail/scoped_deleter.hpp> #include <boost/ptr_container/detail/static_move_ptr.hpp> +#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp> #include <boost/ptr_container/exception.hpp> #include <boost/ptr_container/clone_allocator.hpp> #include <boost/ptr_container/nullable.hpp> @@ -45,6 +46,11 @@ #pragma warning(disable:4224) // formal parameter was previously defined as a type. #endif +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + namespace boost { @@ -345,12 +351,21 @@ namespace ptr_container_detail explicit reversible_ptr_container( const allocator_type& a ) : c_( a ) { } - + +#ifndef BOOST_NO_AUTO_PTR template< class PtrContainer > - explicit reversible_ptr_container( std::auto_ptr<PtrContainer> clone ) - { - swap( *clone ); + explicit reversible_ptr_container( std::auto_ptr<PtrContainer> clone ) + { + swap( *clone ); + } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class PtrContainer > + explicit reversible_ptr_container( std::unique_ptr<PtrContainer> clone ) + { + swap( *clone ); } +#endif reversible_ptr_container( const reversible_ptr_container& r ) { @@ -363,12 +378,22 @@ namespace ptr_container_detail constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() ); } +#ifndef BOOST_NO_AUTO_PTR template< class PtrContainer > reversible_ptr_container& operator=( std::auto_ptr<PtrContainer> clone ) // nothrow { swap( *clone ); return *this; } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class PtrContainer > + reversible_ptr_container& operator=( std::unique_ptr<PtrContainer> clone ) // nothrow + { + swap( *clone ); + return *this; + } +#endif reversible_ptr_container& operator=( reversible_ptr_container r ) // strong { @@ -588,11 +613,20 @@ namespace ptr_container_detail return res; } +#ifndef BOOST_NO_AUTO_PTR template< class U > iterator insert( iterator before, std::auto_ptr<U> x ) { return insert( before, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + iterator insert( iterator before, std::unique_ptr<U> x ) + { + return insert( before, x.release() ); + } +#endif iterator erase( iterator x ) // nothrow { @@ -650,11 +684,20 @@ namespace ptr_container_detail return boost::ptr_container_detail::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() ); + 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 auto_type replace( size_type idx, Ty_* x ) // strong { @@ -669,11 +712,20 @@ namespace ptr_container_detail return boost::ptr_container_detail::move( old ); } +#ifndef BOOST_NO_AUTO_PTR template< class U > auto_type replace( size_type idx, std::auto_ptr<U> x ) { return replace( idx, x.release() ); } +#endif +#ifndef BOOST_NO_CXX11_SMART_PTR + template< class U > + auto_type replace( size_type idx, std::unique_ptr<U> x ) + { + return replace( idx, x.release() ); + } +#endif }; // 'reversible_ptr_container' @@ -689,12 +741,9 @@ namespace ptr_container_detail #define BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) \ using base_type::release; #endif - - // - // two-phase lookup of template functions - // is buggy on most compilers, so we use a macro instead - // -#define BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( PC, base_type, this_type ) \ + +#ifndef BOOST_NO_AUTO_PTR +#define BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_AUTO( PC, base_type, this_type ) \ explicit PC( std::auto_ptr<this_type> r ) \ : base_type ( r ) { } \ \ @@ -702,20 +751,64 @@ namespace ptr_container_detail { \ base_type::operator=( r ); \ return *this; \ - } \ + } +#else +#define BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_AUTO( PC, base_type, this_type ) +#endif + +#ifndef BOOST_NO_CXX11_SMART_PTR +#define BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_UNIQUE( PC, base_type, this_type ) \ + explicit PC( std::unique_ptr<this_type> r ) \ + : base_type ( std::move( r ) ) { } \ \ + PC& operator=( std::unique_ptr<this_type> r ) \ + { \ + base_type::operator=( std::move( r ) ); \ + return *this; \ + } +#else +#define BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_UNIQUE( PC, base_type, this_type ) +#endif + +#ifndef BOOST_NO_AUTO_PTR +#define BOOST_PTR_CONTAINER_RELEASE_AND_CLONE( this_type ) \ std::auto_ptr<this_type> release() \ { \ std::auto_ptr<this_type> ptr( new this_type );\ this->swap( *ptr ); \ return ptr; \ } \ - BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) \ \ std::auto_ptr<this_type> clone() const \ { \ return std::auto_ptr<this_type>( new this_type( this->begin(), this->end() ) ); \ } +#elif !defined( BOOST_NO_CXX11_SMART_PTR ) +#define BOOST_PTR_CONTAINER_RELEASE_AND_CLONE( this_type ) \ + std::unique_ptr<this_type> release() \ + { \ + std::unique_ptr<this_type> ptr( new this_type );\ + this->swap( *ptr ); \ + return ptr; \ + } \ + \ + std::unique_ptr<this_type> clone() const \ + { \ + return std::unique_ptr<this_type>( new this_type( this->begin(), this->end() ) ); \ + } +#else +#define BOOST_PTR_CONTAINER_RELEASE_AND_CLONE( this_type ) +#endif + + // + // two-phase lookup of template functions + // is buggy on most compilers, so we use a macro instead + // +#define BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( PC, base_type, this_type ) \ + BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_AUTO( PC, base_type, this_type ) \ + BOOST_PTR_CONTAINER_COPY_AND_ASSIGN_UNIQUE( PC, base_type, this_type ) \ + BOOST_PTR_CONTAINER_RELEASE_AND_CLONE( this_type ) \ + BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) #define BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( PC, base_type ) \ \ @@ -762,6 +855,10 @@ namespace ptr_container_detail } // namespace 'boost' +#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) +#pragma GCC diagnostic pop +#endif + #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(pop) #endif |