mirror of
https://github.com/Naios/continuable.git
synced 2025-12-08 01:36:46 +08:00
Preserve the ownership across chainings
* Fixes the unit tests
This commit is contained in:
parent
bcafd1b333
commit
6947091a27
@ -718,18 +718,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/*template <typename Continuable>
|
||||
struct continuable_trait
|
||||
#ifdef DOXYGEN
|
||||
{
|
||||
/// Deduces to a true_type if the continuable_base is a concrete type
|
||||
/// which means all lazy expression templates were materialized and
|
||||
/// the continuable can be queried for a direct result through is_ready.
|
||||
using is_concrete = std::true_type;
|
||||
}
|
||||
#endif
|
||||
;*/
|
||||
|
||||
/// Creates a continuable_base from a promise/callback taking function.
|
||||
///
|
||||
/// \tparam Args The types (signature hint) the given promise is resolved with.
|
||||
|
||||
@ -126,7 +126,7 @@ struct attorney {
|
||||
typename T, typename A,
|
||||
typename Continuable = continuable_base<std::decay_t<T>, std::decay_t<A>>>
|
||||
static auto create_from(T&& continuation, A annotation,
|
||||
util::ownership ownership = {}) {
|
||||
util::ownership ownership) {
|
||||
(void)annotation;
|
||||
return Continuable({std::forward<T>(continuation)}, ownership);
|
||||
}
|
||||
@ -755,6 +755,7 @@ auto chain_continuation(Continuation&& continuation, Callback&& callback,
|
||||
next_hint_of(std::integral_constant<handle_results, HandleResults>{},
|
||||
traits::identify<decltype(callback)>{}, Hint{});
|
||||
|
||||
auto ownership = attorney::ownership_of(continuation);
|
||||
auto data =
|
||||
attorney::consume(std::forward<Continuation>(continuation).finish());
|
||||
|
||||
@ -766,7 +767,7 @@ auto chain_continuation(Continuation&& continuation, Callback&& callback,
|
||||
return attorney::create_from(continuation_t(std::move(data),
|
||||
std::forward<Callback>(callback),
|
||||
std::forward<Executor>(executor)),
|
||||
next_hint);
|
||||
next_hint, ownership);
|
||||
}
|
||||
|
||||
/// Final invokes the given continuation chain:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user