mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
more
This commit is contained in:
parent
0a5d22f53a
commit
2e48fde922
32
NextGen.cpp
32
NextGen.cpp
@ -115,7 +115,6 @@ auto appendHandlerToContinuation(Continuation&& cont, Handler&& handler) {
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Continuable.h"
|
|
||||||
|
|
||||||
// Equivalent to C++17's std::void_t which is targets a bug in GCC,
|
// Equivalent to C++17's std::void_t which is targets a bug in GCC,
|
||||||
// that prevents correct SFINAE behavior.
|
// that prevents correct SFINAE behavior.
|
||||||
@ -270,7 +269,7 @@ struct CallbackResultDecorator {
|
|||||||
template<typename Decorator>
|
template<typename Decorator>
|
||||||
struct CallbackResultDecorator<ContinuableBase<Decorator>>{
|
struct CallbackResultDecorator<ContinuableBase<Decorator>>{
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
static auto decorate(Callback&& callback) {
|
static auto decorate(Callback&& callback) -> std::decay_t<Callback> {
|
||||||
return std::forward<Callback>(callback);
|
return std::forward<Callback>(callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -491,7 +490,7 @@ auto thenImpl(Data data, Callback&& callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Data, typename NewDispatcher>
|
template<typename Data, typename NewDispatcher>
|
||||||
auto postImpl(Data data ,NewDispatcher&& newDispatcher) {
|
auto postImpl(Data data, NewDispatcher&& newDispatcher) {
|
||||||
using Decoration = DefaultDecoration<ContinuableData<
|
using Decoration = DefaultDecoration<ContinuableData<
|
||||||
typename Data::Config::template
|
typename Data::Config::template
|
||||||
ChangeDispatcherTo<std::decay_t<NewDispatcher>>
|
ChangeDispatcherTo<std::decay_t<NewDispatcher>>
|
||||||
@ -562,25 +561,15 @@ public:
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
template<typename RightDecoration>
|
template<typename RightDecoration>
|
||||||
auto operator&& (ContinuableBase<RightDecoration>&& right)&& {
|
auto operator&& (ContinuableBase<RightDecoration> right)&& {
|
||||||
return combineImpl(std::move(decoration), std::move(right.decoration));
|
return combineImpl(std::move(decoration), std::move(right.decoration));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RightDecoration>
|
template<typename RightDecoration>
|
||||||
auto operator&& (ContinuableBase<RightDecoration> const& right)&& {
|
auto operator&& (ContinuableBase<RightDecoration> right) const& {
|
||||||
return combineImpl(std::move(decoration), right.decoration);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename RightDecoration>
|
|
||||||
auto operator&& (ContinuableBase<RightDecoration>&& right) const& {
|
|
||||||
return combineImpl(decoration, std::move(right.decoration));
|
return combineImpl(decoration, std::move(right.decoration));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RightDecoration>
|
|
||||||
auto operator&& (ContinuableBase<RightDecoration> const& right) const& {
|
|
||||||
return combineImpl(decoration, right.decoration);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
auto undecorateFor(Callback&&) {
|
auto undecorateFor(Callback&&) {
|
||||||
return decoration.template undecorate<Callback>();
|
return decoration.template undecorate<Callback>();
|
||||||
@ -619,11 +608,11 @@ struct FailIfWrongArgs {
|
|||||||
int main(int, char**) {
|
int main(int, char**) {
|
||||||
auto dispatcher = SelfDispatcher{};
|
auto dispatcher = SelfDispatcher{};
|
||||||
|
|
||||||
(makeTestContinuation() && makeTestContinuation())
|
/*(makeTestContinuation() && makeTestContinuation())
|
||||||
.undecorateFor([]()
|
.undecorateFor([]()
|
||||||
{
|
{
|
||||||
|
|
||||||
});
|
});*/
|
||||||
|
|
||||||
/*auto unwrapper = [](auto&&... args) {
|
/*auto unwrapper = [](auto&&... args) {
|
||||||
return std::common_type<std::tuple<decltype(args)...>>{};
|
return std::common_type<std::tuple<decltype(args)...>>{};
|
||||||
@ -647,6 +636,15 @@ int main(int, char**) {
|
|||||||
})
|
})
|
||||||
.then([&](int val) {
|
.then([&](int val) {
|
||||||
res += val;
|
res += val;
|
||||||
|
})
|
||||||
|
.then([] {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return makeTestContinuation();
|
||||||
|
})
|
||||||
|
.then([] (std::string arg) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user