Skip to content

Commit

Permalink
Add missing variadic template emulation in use_future.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskohlhoff committed Dec 3, 2017
1 parent 5c591a4 commit 4ad7a39
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions asio/include/asio/impl/use_future.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ template <typename Arg>
class promise_handler_selector<void(std::exception_ptr, Arg)>
: public promise_handler_ex_1<Arg> {};

#if defined(ASIO_HAS_VARIADIC_TEMPLATES)

template <typename... Arg>
class promise_handler_selector<void(Arg...)>
: public promise_handler_n<std::tuple<Arg...> > {};
Expand All @@ -555,6 +557,32 @@ template <typename... Arg>
class promise_handler_selector<void(std::exception_ptr, Arg...)>
: public promise_handler_ex_n<std::tuple<Arg...> > {};

#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)

#define ASIO_PRIVATE_PROMISE_SELECTOR_DEF(n) \
template <typename Arg, ASIO_VARIADIC_TPARAMS(n)> \
class promise_handler_selector< \
void(Arg, ASIO_VARIADIC_TARGS(n))> \
: public promise_handler_n< \
std::tuple<Arg, ASIO_VARIADIC_TARGS(n)> > {}; \
\
template <typename Arg, ASIO_VARIADIC_TPARAMS(n)> \
class promise_handler_selector< \
void(asio::error_code, Arg, ASIO_VARIADIC_TARGS(n))> \
: public promise_handler_ec_n< \
std::tuple<Arg, ASIO_VARIADIC_TARGS(n)> > {}; \
\
template <typename Arg, ASIO_VARIADIC_TPARAMS(n)> \
class promise_handler_selector< \
void(std::exception_ptr, Arg, ASIO_VARIADIC_TARGS(n))> \
: public promise_handler_ex_n< \
std::tuple<Arg, ASIO_VARIADIC_TARGS(n)> > {}; \
/**/
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_PROMISE_SELECTOR_DEF)
#undef ASIO_PRIVATE_PROMISE_SELECTOR_DEF

#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)

// Completion handlers produced from the use_future completion token, when not
// using use_future::operator().
template <typename Signature, typename Allocator>
Expand Down

0 comments on commit 4ad7a39

Please sign in to comment.