diff --git a/include/boost/beast/core/async_base.hpp b/include/boost/beast/core/async_base.hpp index 55e912c1..693d9761 100644 --- a/include/boost/beast/core/async_base.hpp +++ b/include/boost/beast/core/async_base.hpp @@ -177,7 +177,8 @@ template< > class async_base #if ! BOOST_BEAST_DOXYGEN - : private boost::empty_value + : public detail::with_immediate_executor_type + , private boost::empty_value #endif { static_assert( @@ -193,7 +194,7 @@ public: If a class derived from @ref boost::beast::async_base is a completion handler, then the associated executor of the derived class will be this type. -*/ + */ using executor_type = #if BOOST_BEAST_DOXYGEN __implementation_defined__; @@ -210,19 +211,12 @@ public: If a class derived from @ref boost::beast::async_base is a completion handler, then the associated immediage executor of the derived class will be this type. -*/ - using immediate_executor_type = + */ #if BOOST_BEAST_DOXYGEN + using immediate_executor_type = __implementation_defined__; -#else - typename - net::associated_immediate_executor< - Handler, - typename detail::select_work_guard_t::executor_type - >::type; #endif - private: virtual @@ -333,8 +327,10 @@ public: handler, then the object returned from this function will be used as the associated immediate executor of the derived class. */ - immediate_executor_type + auto get_immediate_executor() const noexcept + -> decltype(net::get_associated_immediate_executor( + h_, wg1_.get_executor())) { return net::get_associated_immediate_executor( h_, wg1_.get_executor()); diff --git a/include/boost/beast/core/detail/async_base.hpp b/include/boost/beast/core/detail/async_base.hpp index 0224daf7..dee238d6 100644 --- a/include/boost/beast/core/detail/async_base.hpp +++ b/include/boost/beast/core/detail/async_base.hpp @@ -10,7 +10,9 @@ #ifndef BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP #define BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP -#include +#include + +#include namespace boost { namespace beast { @@ -39,6 +41,18 @@ protected: virtual void destroy() = 0; }; +template +struct with_immediate_executor_type +{ +}; + +template +struct with_immediate_executor_type> +{ + using immediate_executor_type = typename Handler::immediate_executor_type; +}; + } // detail } // beast } // boost