mirror of
https://github.com/Naios/continuable.git
synced 2025-12-08 01:36:46 +08:00
Fix an issue with the is_ready overload
This commit is contained in:
parent
4b1f6281fc
commit
9ceee76647
@ -99,11 +99,11 @@ class result_submitter
|
||||
}
|
||||
|
||||
template <typename... PartialArgs>
|
||||
void operator()(exception_arg_t tag, exception_t error) && {
|
||||
void operator()(exception_arg_t tag, exception_t exception) && {
|
||||
// We never complete the connection, but we forward the first error
|
||||
// which was raised.
|
||||
std::call_once(me->flag_, std::move(me->callback_), tag,
|
||||
std::move(error));
|
||||
std::move(exception));
|
||||
}
|
||||
};
|
||||
|
||||
@ -168,8 +168,8 @@ struct connection_finalizer<connection_strategy_all_tag> {
|
||||
all::result_submitter<std::decay_t<decltype(callback)>,
|
||||
std::decay_t<decltype(result)>>;
|
||||
|
||||
// Create the shared state which holds the result and the final
|
||||
// callback
|
||||
// Create the shared state which holds the result
|
||||
// and the final callback
|
||||
auto state = std::make_shared<submitter_t>(
|
||||
std::forward<decltype(callback)>(callback), std::move(result));
|
||||
|
||||
|
||||
@ -757,12 +757,12 @@ struct chained_continuation<traits::identity<Args...>, HandleResults,
|
||||
|
||||
// TODO Detect statically whether we have a raw ready continuable here
|
||||
// Check whether the continuation is ready
|
||||
bool const is_ready = continuation_(is_ready_arg_t{});
|
||||
bool const is_ready = util::as_const(continuation_)(is_ready_arg_t{});
|
||||
if (is_ready) {
|
||||
// Invoke the proxy callback directly with the result to
|
||||
// avoid a potential type erasure.
|
||||
// traits::unpack(std::move(proxy),
|
||||
// std::move(continuation_)(query_arg_t{}));
|
||||
std::move(continuation_)(query_arg_t{});
|
||||
} else {
|
||||
// Invoke the continuation with a proxy callback.
|
||||
// The proxy callback is responsible for passing
|
||||
|
||||
@ -167,6 +167,12 @@ constexpr auto invoke(Type T::*member, Self&& self, Args&&... args) noexcept(
|
||||
return (std::forward<Self>(self)->*member)(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
/// Returns a constant view on the object
|
||||
template <typename T>
|
||||
constexpr std::add_const_t<T>& as_const(T& object) noexcept {
|
||||
return object;
|
||||
}
|
||||
|
||||
// Class for making child classes non copyable
|
||||
struct non_copyable {
|
||||
constexpr non_copyable() = default;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user