From 4e9d87fd903a438fbec791f3e508c4edf0149edd Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Thu, 11 Jun 2015 17:46:44 +0200 Subject: [PATCH] some minor improvements --- fluent/Continuable.h | 27 ++++++++++++---------- fluent/fluent++.hpp | 55 -------------------------------------------- 2 files changed, 15 insertions(+), 67 deletions(-) diff --git a/fluent/Continuable.h b/fluent/Continuable.h index de78d0b..3375caf 100644 --- a/fluent/Continuable.h +++ b/fluent/Continuable.h @@ -27,7 +27,10 @@ namespace detail } // detail template -struct ContinuableState +struct ContinuableState; + +template +struct ContinuableState { }; @@ -41,12 +44,11 @@ public: typedef std::function&&)> ForwardFunction; private: - - // Function which expects a callback that is inserted from the Continuable + // Functional which expects a callback that is inserted from the Continuable // to chain everything together ForwardFunction _callback_insert; - bool released; + bool _released; void Dispatch() { @@ -55,26 +57,27 @@ private: public: /// Deleted copy construct template - Continuable(Continuable<_RCTy, _RState> const&) = delete; + explicit Continuable(Continuable<_RCTy, _RState> const&) = delete; /// Move construct template - Continuable(Continuable<_RCTy, _RState>&& right) : released(right.released) + explicit Continuable(Continuable<_RCTy, _RState>&& right) + : _released(right._released) { - right.released = true; + right._released = true; } // Construct through a ForwardFunction template Continuable(_FTy&& callback_insert) - : _callback_insert(std::forward<_FTy>(callback_insert)), released(false) { } + : _callback_insert(std::forward<_FTy>(callback_insert)), _released(false) { } /// Destructor which calls the dispatch chain if needed. ~Continuable() { - if (!released) + if (!_released) { - released = true; + _released = true; Dispatch(); } } @@ -87,8 +90,8 @@ public: template Continuable& operator= (Continuable<_RCTy, _RState>&& right) { - released = right.released; - right.released = true; + _released = right._released; + right._released = true; return *this; } diff --git a/fluent/fluent++.hpp b/fluent/fluent++.hpp index b28efc8..e941e55 100644 --- a/fluent/fluent++.hpp +++ b/fluent/fluent++.hpp @@ -9,61 +9,6 @@ #include "functional_unwrap.hpp" /* -class fluent_step -{ - bool released; - - void release() - { - int i = 0; - - std::cout << "-> release" << std::endl; - } - -public: - fluent_step() : released(false) - { - std::cout << "+ construct" << std::endl; - } - - ~fluent_step() - { - std::cout << "- destruct" << std::endl; - - if (!released) - release(); - } - - fluent_step(fluent_step const&) = delete; - fluent_step(fluent_step&& right) : released(false) - { - std::cout << "<-> move" << std::endl; - - right.released = true; - } - - fluent_step& operator= (fluent_step const&) = delete; - fluent_step& operator= (fluent_step&& right) - { - released = false; - right.released = true; - return *this; - } - - template - fluent_step then(Callback&& callback) - { - return std::move(*this); - } -}; - -template -fluent_step make_waterfall() -{ - return fluent_step(); -} - - struct ProtoContinueable { template