diff --git a/include/boost/asio/detail/config.hpp b/include/boost/asio/detail/config.hpp index baeb86d7..754cfa48 100644 --- a/include/boost/asio/detail/config.hpp +++ b/include/boost/asio/detail/config.hpp @@ -283,6 +283,14 @@ # endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR) #endif // !defined(BOOST_ASIO_HAS_STD_SHARED_PTR) +// owning pointer, either (removed in c++17) auto_ptr or unique_ptr +// take presence of shared_ptr as proxy for unique_ptr +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) && (BOOST_ASIO_HAS_STD_SHARED_PTR == 1) +# define BOOST_ASIO_RAII_PTR std::unique_ptr +#else +# define BOOST_ASIO_RAII_PTR std::auto_ptr +#endif + // Standard library support for atomic operations. #if !defined(BOOST_ASIO_HAS_STD_ATOMIC) # if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC) diff --git a/include/boost/asio/detail/winapi_thread.hpp b/include/boost/asio/detail/winapi_thread.hpp index 204e73f4..294f4b44 100644 --- a/include/boost/asio/detail/winapi_thread.hpp +++ b/include/boost/asio/detail/winapi_thread.hpp @@ -42,7 +42,7 @@ class winapi_thread template winapi_thread(Function f, unsigned int = 0) { - std::auto_ptr arg(new func(f)); + BOOST_ASIO_RAII_PTR arg(new func(f)); DWORD thread_id = 0; thread_ = ::CreateThread(0, 0, winapi_thread_function, arg.get(), 0, &thread_id); @@ -106,7 +106,7 @@ class winapi_thread inline DWORD WINAPI winapi_thread_function(LPVOID arg) { - std::auto_ptr func( + BOOST_ASIO_RAII_PTR func( static_cast(arg)); func->run(); return 0; diff --git a/include/boost/asio/io_service.hpp b/include/boost/asio/io_service.hpp index f2b46673..8161f596 100644 --- a/include/boost/asio/io_service.hpp +++ b/include/boost/asio/io_service.hpp @@ -140,7 +140,7 @@ namespace detail { * be allowed to finish normally, the work object may be explicitly destroyed. * * @code boost::asio::io_service io_service; - * auto_ptr work( + * unique_ptr work( * new boost::asio::io_service::work(io_service)); * ... * work.reset(); // Allow run() to exit. @endcode diff --git a/include/boost/asio/ssl/old/detail/openssl_stream_service.hpp b/include/boost/asio/ssl/old/detail/openssl_stream_service.hpp index afccf365..e8039671 100644 --- a/include/boost/asio/ssl/old/detail/openssl_stream_service.hpp +++ b/include/boost/asio/ssl/old/detail/openssl_stream_service.hpp @@ -101,7 +101,7 @@ class openssl_stream_service Handler handler_; void handler_impl(const boost::system::error_code& error, size_t size) { - std::auto_ptr > this_ptr(this); + BOOST_ASIO_RAII_PTR > this_ptr(this); handler_(error, size); } }; // class io_handler @@ -125,7 +125,7 @@ class openssl_stream_service Handler handler_; void handler_impl(const boost::system::error_code& error, size_t) { - std::auto_ptr > this_ptr(this); + BOOST_ASIO_RAII_PTR > this_ptr(this); handler_(error); } @@ -150,7 +150,7 @@ class openssl_stream_service Handler handler_; void handler_impl(const boost::system::error_code& error, size_t) { - std::auto_ptr > this_ptr(this); + BOOST_ASIO_RAII_PTR > this_ptr(this); handler_(error); } }; // class shutdown_handler