mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Add explicit
This commit is contained in:
parent
90a12e10f7
commit
43bf7180f2
24
NextGen.cpp
24
NextGen.cpp
@ -177,8 +177,8 @@ struct CallbackResultDecorator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// No decoration is needed for continuables
|
/// No decoration is needed for continuables
|
||||||
template<typename Config>
|
template<typename Decorator>
|
||||||
struct CallbackResultDecorator<ContinuableBase<Config>>{
|
struct CallbackResultDecorator<ContinuableBase<Decorator>>{
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
static auto decorate(Callback&& callback) {
|
static auto decorate(Callback&& callback) {
|
||||||
return std::forward<Callback>(callback);
|
return std::forward<Callback>(callback);
|
||||||
@ -283,6 +283,11 @@ struct ContinuableData {
|
|||||||
continuation(std::move(continuation_)),
|
continuation(std::move(continuation_)),
|
||||||
dispatcher(std::move(dispatcher_)) { }
|
dispatcher(std::move(dispatcher_)) { }
|
||||||
|
|
||||||
|
ContinuableData(typename Config::Continuation continuation_,
|
||||||
|
typename Config::Dispatcher dispatcher_) noexcept
|
||||||
|
: continuation(std::move(continuation_)),
|
||||||
|
dispatcher(std::move(dispatcher_)) { }
|
||||||
|
|
||||||
Ownership ownership;
|
Ownership ownership;
|
||||||
typename Config::Continuation continuation;
|
typename Config::Continuation continuation;
|
||||||
typename Config::Dispatcher dispatcher;
|
typename Config::Dispatcher dispatcher;
|
||||||
@ -293,7 +298,7 @@ struct ContinuableData {
|
|||||||
template<typename Data>
|
template<typename Data>
|
||||||
class DefaultDecoration {
|
class DefaultDecoration {
|
||||||
public:
|
public:
|
||||||
DefaultDecoration(Data data_)
|
explicit DefaultDecoration(Data data_)
|
||||||
: data(std::move(data_)) { }
|
: data(std::move(data_)) { }
|
||||||
|
|
||||||
using Config = typename Data::Config;
|
using Config = typename Data::Config;
|
||||||
@ -318,11 +323,10 @@ auto make_continuable(Continuation&& continuation,
|
|||||||
std::decay_t<Continuation>,
|
std::decay_t<Continuation>,
|
||||||
std::decay_t<Dispatcher>
|
std::decay_t<Dispatcher>
|
||||||
>>>;
|
>>>;
|
||||||
return ContinuableBase<Decoration> { { {
|
return ContinuableBase<Decoration>(Decoration({
|
||||||
{ },
|
|
||||||
std::forward<Continuation>(continuation),
|
std::forward<Continuation>(continuation),
|
||||||
std::forward<Dispatcher>(dispatcher)
|
std::forward<Dispatcher>(dispatcher)
|
||||||
} } };
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Data, typename Callback>
|
template<typename Data, typename Callback>
|
||||||
@ -332,9 +336,11 @@ auto thenImpl(Data data, Callback&& callback) {
|
|||||||
using Decoration = DefaultDecoration<ContinuableData<
|
using Decoration = DefaultDecoration<ContinuableData<
|
||||||
typename Data::Config::template ChangeContinuationTo<decltype(next)>
|
typename Data::Config::template ChangeContinuationTo<decltype(next)>
|
||||||
>>;
|
>>;
|
||||||
return ContinuableBase<Decoration> { {
|
return ContinuableBase<Decoration>(Decoration({
|
||||||
{ std::move(data.ownership), std::move(next), std::move(data.dispatcher) }
|
std::move(data.ownership),
|
||||||
} };
|
std::move(next),
|
||||||
|
std::move(data.dispatcher)
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Data, typename NewDispatcher>
|
template<typename Data, typename NewDispatcher>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user