Skip to content

Commit

Permalink
Change as_tuple to propagate an initiation object's executor.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskohlhoff committed Jun 25, 2024
1 parent 54282a8 commit 1d5a685
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions asio/include/asio/impl/as_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "asio/associator.hpp"
#include "asio/async_result.hpp"
#include "asio/detail/handler_cont_helpers.hpp"
#include "asio/detail/initiation_base.hpp"
#include "asio/detail/type_traits.hpp"

#include "asio/detail/push_options.hpp"
Expand Down Expand Up @@ -119,23 +120,27 @@ struct async_result<as_tuple_t<CompletionToken>, Signatures...>
typename detail::as_tuple_signature<Signatures>::type...>
{
template <typename Initiation>
struct init_wrapper
struct init_wrapper : detail::initiation_base<Initiation>
{
init_wrapper(Initiation init)
: initiation_(static_cast<Initiation&&>(init))
using detail::initiation_base<Initiation>::initiation_base;

template <typename Handler, typename... Args>
void operator()(Handler&& handler, Args&&... args) &&
{
static_cast<Initiation&&>(*this)(
detail::as_tuple_handler<decay_t<Handler>>(
static_cast<Handler&&>(handler)),
static_cast<Args&&>(args)...);
}

template <typename Handler, typename... Args>
void operator()(Handler&& handler, Args&&... args)
void operator()(Handler&& handler, Args&&... args) const &
{
static_cast<Initiation&&>(initiation_)(
static_cast<const Initiation&>(*this)(
detail::as_tuple_handler<decay_t<Handler>>(
static_cast<Handler&&>(handler)),
static_cast<Args&&>(args)...);
}

Initiation initiation_;
};

template <typename Initiation, typename RawCompletionToken, typename... Args>
Expand Down

0 comments on commit 1d5a685

Please sign in to comment.