diff --git a/include/Continuable.h b/include/Continuable.h index 2e54bb1..8c5c2d8 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -40,22 +40,6 @@ namespace detail struct is_continuable> : std::true_type { }; - /// Creates an empty callback. - template - struct create_empty_callback; - - template - struct create_empty_callback&&)>> - { - static auto create() - -> Callback - { - return [](Args&&...) - { - }; - } - }; - template struct continuable_corrector; @@ -131,22 +115,17 @@ public: _released = true; // Invoke everything with an empty callback - _callback_insert(detail::create_empty_callback::create()); + _callback_insert([](_ATy&&...) + { + }); } } /// Deleted copy assign Continuable& operator= (Continuable const&) = delete; - /// Move construct assign - Continuable& operator= (Continuable&& right) - { - _released = right._released; - right._released = true; - - _callback_insert = std::move(right._callback_insert); - return *this; - } + /// Deleted move assign + Continuable& operator= (Continuable&&) = delete; /// Waits for this continuable and invokes the given callback. template diff --git a/test.cpp b/test.cpp index 5f8b854..b38bd47 100644 --- a/test.cpp +++ b/test.cpp @@ -151,12 +151,25 @@ TEST_CASE("Continuable invocation on destruct", "[Continuable]") REQUIRE(invoked); } + + SECTION("Continuables are not invoked after transferred") + { + Continuable<> continuable = make_continuable(std::move(invokeable)); + + { + Continuable<> cache = std::move(continuable); + + REQUIRE_FALSE(invoked); + } + + REQUIRE(invoked); + } } TEST_CASE("Continuable continuation chaining using Continuable::then", "[Continuable]") { SECTION("Continuables are invalidated on chaining (no duplicated call)") { - std::size_t invoked = 0; + //std::size_t invoked = 0; } }