diff options
Diffstat (limited to 'boost/asio/windows/overlapped_ptr.hpp')
-rw-r--r-- | boost/asio/windows/overlapped_ptr.hpp | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/boost/asio/windows/overlapped_ptr.hpp b/boost/asio/windows/overlapped_ptr.hpp index 8c95ce45f9..a891248ceb 100644 --- a/boost/asio/windows/overlapped_ptr.hpp +++ b/boost/asio/windows/overlapped_ptr.hpp @@ -2,7 +2,7 @@ // windows/overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) @@ -50,10 +50,24 @@ public: } /// Construct an overlapped_ptr to contain the specified handler. - template <typename Handler> - explicit overlapped_ptr(boost::asio::io_context& io_context, - BOOST_ASIO_MOVE_ARG(Handler) handler) - : impl_(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)) + template <typename ExecutionContext, typename Handler> + explicit overlapped_ptr(ExecutionContext& context, + BOOST_ASIO_MOVE_ARG(Handler) handler, + typename enable_if< + is_convertible<ExecutionContext&, execution_context&>::value + >::type* = 0) + : impl_(context.get_executor(), BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + + /// Construct an overlapped_ptr to contain the specified handler. + template <typename Executor, typename Handler> + explicit overlapped_ptr(const Executor& ex, + BOOST_ASIO_MOVE_ARG(Handler) handler, + typename enable_if< + is_executor<Executor>::value + >::type* = 0) + : impl_(ex, BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -70,11 +84,24 @@ public: /// Reset to contain the specified handler, freeing any current OVERLAPPED /// object. - template <typename Handler> - void reset(boost::asio::io_context& io_context, - BOOST_ASIO_MOVE_ARG(Handler) handler) + template <typename ExecutionContext, typename Handler> + void reset(ExecutionContext& context, BOOST_ASIO_MOVE_ARG(Handler) handler, + typename enable_if< + is_convertible<ExecutionContext&, execution_context&>::value + >::type* = 0) + { + impl_.reset(context.get_executor(), BOOST_ASIO_MOVE_CAST(Handler)(handler)); + } + + /// Reset to contain the specified handler, freeing any current OVERLAPPED + /// object. + template <typename Executor, typename Handler> + void reset(const Executor& ex, BOOST_ASIO_MOVE_ARG(Handler) handler, + typename enable_if< + is_executor<Executor>::value + >::type* = 0) { - impl_.reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)); + impl_.reset(ex, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } /// Get the contained OVERLAPPED object. |