diff --git a/NextGen.cpp b/NextGen.cpp index b6f6e4b..2efb629 100644 --- a/NextGen.cpp +++ b/NextGen.cpp @@ -177,8 +177,8 @@ struct CallbackResultDecorator { }; /// No decoration is needed for continuables -template -struct CallbackResultDecorator>{ +template +struct CallbackResultDecorator>{ template static auto decorate(Callback&& callback) { return std::forward(callback); @@ -283,6 +283,11 @@ struct ContinuableData { continuation(std::move(continuation_)), dispatcher(std::move(dispatcher_)) { } + ContinuableData(typename Config::Continuation continuation_, + typename Config::Dispatcher dispatcher_) noexcept + : continuation(std::move(continuation_)), + dispatcher(std::move(dispatcher_)) { } + Ownership ownership; typename Config::Continuation continuation; typename Config::Dispatcher dispatcher; @@ -293,7 +298,7 @@ struct ContinuableData { template class DefaultDecoration { public: - DefaultDecoration(Data data_) + explicit DefaultDecoration(Data data_) : data(std::move(data_)) { } using Config = typename Data::Config; @@ -318,11 +323,10 @@ auto make_continuable(Continuation&& continuation, std::decay_t, std::decay_t >>>; - return ContinuableBase { { { - { }, + return ContinuableBase(Decoration({ std::forward(continuation), std::forward(dispatcher) - } } }; + })); } template @@ -332,9 +336,11 @@ auto thenImpl(Data data, Callback&& callback) { using Decoration = DefaultDecoration >>; - return ContinuableBase { { - { std::move(data.ownership), std::move(next), std::move(data.dispatcher) } - } }; + return ContinuableBase(Decoration({ + std::move(data.ownership), + std::move(next), + std::move(data.dispatcher) + })); } template