mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Fix the MSVC 16 build
This commit is contained in:
parent
0afdbec2cc
commit
92d8bbad36
@ -130,23 +130,18 @@ class result {
|
||||
using trait_t = detail::result_trait<T...>;
|
||||
using surrogate_t = typename trait_t::surrogate_t;
|
||||
|
||||
struct init_arg_t {};
|
||||
|
||||
template <typename... Args, detail::traits::void_t<decltype(trait_t::wrap(
|
||||
std::declval<Args>()...))>* = nullptr>
|
||||
explicit result(init_arg_t, Args&&... values)
|
||||
template <typename... Args>
|
||||
explicit result(detail::init_arg_t, Args&&... values)
|
||||
: variant_(trait_t::wrap(std::forward<Args>(values)...)) {
|
||||
}
|
||||
explicit result(init_arg_t, exception_t exception)
|
||||
explicit result(detail::init_arg_t, exception_t exception)
|
||||
: variant_(std::move(exception)) {
|
||||
}
|
||||
|
||||
public:
|
||||
using value_t = typename trait_t::value_t;
|
||||
|
||||
template <typename FirstArg, typename... Args,
|
||||
detail::traits::void_t<decltype(trait_t::wrap(
|
||||
std::declval<FirstArg>(), std::declval<Args>()...))>* = nullptr>
|
||||
template <typename FirstArg, typename... Args>
|
||||
explicit result(FirstArg&& first, Args&&... values)
|
||||
: variant_(trait_t::wrap(std::forward<FirstArg>(first),
|
||||
std::forward<Args>(values)...)) {
|
||||
@ -250,11 +245,11 @@ public:
|
||||
|
||||
/// Creates a present result from the given values
|
||||
static result from(T... values) {
|
||||
return result{init_arg_t{}, std::move(values)...};
|
||||
return result{detail::init_arg_t{}, std::move(values)...};
|
||||
}
|
||||
/// Creates a present result from the given exception
|
||||
static result from(exception_t exception) {
|
||||
return result{init_arg_t{}, std::move(exception)};
|
||||
return result{detail::init_arg_t{}, std::move(exception)};
|
||||
}
|
||||
|
||||
/// Creates an empty result
|
||||
|
||||
@ -54,16 +54,15 @@ struct loop_trait {
|
||||
"cti::continuable_base which resolves to a cti::result.");
|
||||
};
|
||||
|
||||
template <typename Continuation, typename... Args>
|
||||
struct loop_trait<continuable_base<Continuation, //
|
||||
signature_arg_t<result<Args...>>>> {
|
||||
template <typename... Args>
|
||||
struct loop_trait<identity<result<Args...>>> {
|
||||
template <typename Callable>
|
||||
static auto make(Callable&& callable) {
|
||||
return make_continuable<Args...>(std::forward<Callable>(callable));
|
||||
}
|
||||
};
|
||||
template <typename Continuation>
|
||||
struct loop_trait<continuable_base<Continuation, signature_arg_t<result<>>>> {
|
||||
template <>
|
||||
struct loop_trait<identity<result<>>> {
|
||||
template <typename Callable>
|
||||
static auto make(Callable&& callable) {
|
||||
return make_continuable<void>(std::forward<Callable>(callable));
|
||||
@ -143,7 +142,11 @@ template <typename Callable, typename... Args>
|
||||
auto loop(Callable&& callable, Args&&... args) {
|
||||
using invocation_result_t =
|
||||
decltype(util::invoke(callable, args...).finish());
|
||||
using trait_t = loop_trait<invocation_result_t>;
|
||||
|
||||
auto constexpr hint = base::annotation_of(identify<invocation_result_t>{});
|
||||
|
||||
using trait_t = loop_trait<std::remove_const_t<decltype(hint)>>;
|
||||
|
||||
return trait_t::make([callable = std::forward<decltype(callable)>(callable),
|
||||
args = std::make_tuple(std::forward<decltype(args)>(
|
||||
args)...)](auto&& promise) mutable {
|
||||
|
||||
@ -93,6 +93,8 @@ struct result_trait<First, Second, Rest...> {
|
||||
return std::get<I>(std::forward<Result>(result).get_value());
|
||||
}
|
||||
};
|
||||
|
||||
struct init_arg_t {};
|
||||
} // namespace detail
|
||||
} // namespace cti
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user