Add constraints to use_awaitable_t::executor_with_default's constructor to prevent template instantiation recursion.

This commit is contained in:
Christopher Kohlhoff 2021-05-08 17:56:23 +10:00
parent c12bdd3d23
commit 77bcfe775a

View File

@ -99,17 +99,14 @@ struct use_awaitable_t
typedef use_awaitable_t default_completion_token_type;
/// Construct the adapted executor from the inner executor type.
executor_with_default(const InnerExecutor& ex) ASIO_NOEXCEPT
: InnerExecutor(ex)
{
}
/// Convert the specified executor to the inner executor type, then use
/// that to construct the adapted executor.
template <typename OtherExecutor>
executor_with_default(const OtherExecutor& ex,
template <typename InnerExecutor1>
executor_with_default(const InnerExecutor1& ex,
typename constraint<
is_convertible<OtherExecutor, InnerExecutor>::value
conditional<
!is_same<InnerExecutor1, executor_with_default>::value,
is_convertible<InnerExecutor1, InnerExecutor>,
false_type
>::type::value
>::type = 0) ASIO_NOEXCEPT
: InnerExecutor(ex)
{