From a861f16af29332fc32af3f69b740ce609bb44aa8 Mon Sep 17 00:00:00 2001 From: Naios Date: Tue, 21 Jul 2015 18:56:40 +0200 Subject: [PATCH] more cleanup --- include/Continuable.h | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/include/Continuable.h b/include/Continuable.h index 616303b..50970a0 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -332,9 +332,9 @@ namespace detail struct void_wrap_trait> { template - static std::function(_ATy...)> wrap(_CTy&& functional) + static std::function(_ATy...)> wrap(_CTy&& functional_) { - return [functional](_ATy&&... args) + return [functional = std::forward<_CTy>(functional_)](_ATy&&... args) { // Invoke the original callback functional(std::forward<_ATy>(args)...); @@ -354,33 +354,6 @@ namespace detail typedef Tuple tuple; }; - /* - template - struct continuable_returner - { - typename std::decay<_CTy>::type returning_continuable; - - continuable_returner(typename std::decay<_CTy>::type&& returning_continuable_) - : returning_continuable(returning_continuable_) { } - - continuable_returner(continuable_returner&) = delete; - - continuable_returner& operator= (continuable_returner&) = delete; - - continuable_returner& operator= (continuable_returner&& right) - { - returning_continuable = std::move(right.returning_continuable); - return *this; - }; - - auto operator()(_ATy&&...) - -> typename std::decay<_CTy>::type - { - return std::move(returning_continuable); - } - }; - */ - /// Continuable processing detail implementation template struct functional_traits @@ -441,13 +414,13 @@ namespace detail // Trick C++11 lambda capture rules for non copyable but moveable continuables. // TODO Use the stack instead of heap variables. - std::shared_ptr::type> shared_continuable = - std::make_shared::type>(std::forward<_CTy>(continuable)); + // std::shared_ptr::type> shared_continuable = + // std::make_shared::type>(std::forward<_CTy>(continuable)); // Create a fake function which returns the value on invoke. - return [shared_continuable](_ATy&&...) + return [continuable_ = std::forward<_CTy>(continuable)](_ATy&&...) mutable { - return std::move(*shared_continuable); + return std::move(continuable_); }; }