diff --git a/include/boost/asio/basic_socket_streambuf.hpp b/include/boost/asio/basic_socket_streambuf.hpp index bd9c8d8d..3da96233 100644 --- a/include/boost/asio/basic_socket_streambuf.hpp +++ b/include/boost/asio/basic_socket_streambuf.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -85,7 +84,28 @@ protected: { } - shared_ptr default_io_context_; +#if defined(BOOST_ASIO_HAS_MOVE) + socket_streambuf_io_context(socket_streambuf_io_context&& other) + : default_io_context_(other.default_io_context_) + { + other.default_io_context_ = 0; + } + + socket_streambuf_io_context& operator=(socket_streambuf_io_context&& other) + { + delete default_io_context_; + default_io_context_ = other.default_io_context_; + other.default_io_context_ = 0; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + io_context* default_io_context_; + +private: + // Disallow copying and assignment. + socket_streambuf_io_context(const socket_streambuf_io_context&); + socket_streambuf_io_context& operator=(const socket_streambuf_io_context&); }; // A separate base class is used to ensure that the dynamically allocated @@ -229,7 +249,7 @@ public: { this->close(); socket() = std::move(other.socket()); - detail::socket_streambuf_io_context::operator=(other); + detail::socket_streambuf_io_context::operator=(std::move(other)); ec_ = other.ec_; expiry_time_ = other.expiry_time_; get_buffer_.swap(other.get_buffer_);