From 5ed9f7712efac315ddda5c1922a2bce7e24398c9 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 14 Feb 2019 12:54:32 -0800 Subject: [PATCH] basic_stream uses boost::shared_ptr --- CHANGELOG.md | 6 ++++++ include/boost/beast/core/basic_stream.hpp | 9 +++++---- include/boost/beast/core/impl/basic_stream.hpp | 15 ++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1035c79..887bde5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 215: + +* basic_stream uses boost::shared_ptr + +-------------------------------------------------------------------------------- + Version 214: * Handler binders use the associated allocator diff --git a/include/boost/beast/core/basic_stream.hpp b/include/boost/beast/core/basic_stream.hpp index 03019be9..97866e00 100644 --- a/include/boost/beast/core/basic_stream.hpp +++ b/include/boost/beast/core/basic_stream.hpp @@ -21,8 +21,9 @@ #include #include #include +#include +#include #include -#include namespace boost { namespace asio { @@ -200,7 +201,7 @@ class basic_stream public: #endif struct impl_type - : std::enable_shared_from_this + : boost::enable_shared_from_this , boost::empty_value { op_state read; @@ -227,7 +228,7 @@ public: Executor const& ex() const noexcept { - return this->get(); + return this->boost::empty_value::get(); } void reset(); // set timeouts to never @@ -241,7 +242,7 @@ private: // outlive the destruction of the stream_socket object, // in the case where there is no outstanding read or write // but the implementation is still waiting on a timer. - std::shared_ptr impl_; + boost::shared_ptr impl_; // Restricted until P1322R0 is incorporated into Boost.Asio. static_assert( diff --git a/include/boost/beast/core/impl/basic_stream.hpp b/include/boost/beast/core/impl/basic_stream.hpp index c0cb0743..925f981e 100644 --- a/include/boost/beast/core/impl/basic_stream.hpp +++ b/include/boost/beast/core/impl/basic_stream.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -118,7 +119,7 @@ struct basic_stream< Protocol, Executor>::timeout_handler { op_state& state; - std::weak_ptr wp; + boost::weak_ptr wp; tick_type tick; void @@ -163,7 +164,7 @@ class basic_stream::async_op : public async_op_base , public boost::asio::coroutine { - std::shared_ptr impl_; + boost::shared_ptr impl_; pending_guard pg_; Buffers b_; @@ -292,7 +293,7 @@ class basic_stream_connect_op using timeout_handler = typename stream_type::timeout_handler; - std::shared_ptr impl_; typename stream_type::pending_guard pg0_; typename stream_type::pending_guard pg1_; @@ -437,7 +438,7 @@ template template basic_stream:: basic_stream(ExecutionContext& ctx, Args&&... args) - : impl_(std::make_shared( + : impl_(boost::make_shared( ctx.get_executor(), ctx, std::forward(args)...)) { @@ -452,7 +453,7 @@ template basic_stream:: basic_stream( executor_type const& ex, Args&&... args) - : impl_(std::make_shared( + : impl_(boost::make_shared( ex, ex.context(), std::forward(args)...)) { @@ -462,7 +463,7 @@ template template basic_stream:: basic_stream(net::basic_stream_socket&& socket) - : impl_(std::make_shared( + : impl_(boost::make_shared( std::move(socket), std::is_constructible&& socket) template basic_stream:: basic_stream(basic_stream&& other) - : impl_(std::make_shared( + : impl_(boost::make_shared( std::move(*other.impl_))) { // VFALCO I'm not sure this implementation is correct...