From 632c8a4d806705630892729d19924c080c8e668d Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Wed, 17 Jun 2015 00:19:35 +0200 Subject: [PATCH] some changes --- fluent/Continuable.h | 18 ++++++++++-------- test.cpp | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/fluent/Continuable.h b/fluent/Continuable.h index 010a9e5..6302e45 100644 --- a/fluent/Continuable.h +++ b/fluent/Continuable.h @@ -125,14 +125,16 @@ namespace detail bool _released; template - _ContinuableImpl& operator()(_CTy callback) + void invoke(_CTy&& callback) { - // Invalidate this - _released = true; + if (!_released) + { + // Invalidate this + _released = true; - // Invoke this - _callback_insert(std::forward<_CTy>(callback)); - return *this; + // Invoke this + _callback_insert(std::forward<_CTy>(callback)); + } } // Pack a continuable into the continuable returning functional type. @@ -233,7 +235,7 @@ namespace detail { // Invoke the next callback unary_chainer_t<_CTy>::base::invoke(functional, std::forward<_ATy>(args)...) - (std::move(call_next)); + .invoke(std::move(call_next)); }); }, std::move(*this)); @@ -375,7 +377,7 @@ inline auto make_continuable(_FTy&& functional) /// .all(...) /// .some(...) /// .any(...) -inline auto empty_continuable() +inline auto make_continuable() -> Continuable<> { return make_continuable([](Callback<>&& callback) diff --git a/test.cpp b/test.cpp index c930a7e..d73bdaf 100644 --- a/test.cpp +++ b/test.cpp @@ -92,7 +92,7 @@ int main(int /*argc*/, char** /*argv*/) }); // Mockup of aggregate methods - empty_continuable() + make_continuable() .all( [] { return TrivialPromise(); }, [] { return TrivialPromise(); },