fix some wrong releases

This commit is contained in:
Denis Blank 2015-06-11 17:34:22 +02:00 committed by Naios
parent 137d5a9f19
commit c82a721b37
2 changed files with 14 additions and 6 deletions

View File

@ -59,11 +59,16 @@ public:
/// Move construct
template <typename _RCTy, typename _RState>
Continuable(Continuable<_RCTy, _RState>&& right) : released(false)
Continuable(Continuable<_RCTy, _RState>&& right) : released(right.released)
{
right.released = true;
}
// Construct through a ForwardFunction
template<typename _FTy>
Continuable(_FTy&& callback_insert)
: _callback_insert(std::forward<_FTy>(callback_insert)), released(false) { }
/// Destructor which calls the dispatch chain if needed.
~Continuable()
{
@ -87,13 +92,11 @@ public:
return *this;
}
template<typename _FTy>
Continuable(_FTy&& callback_insert)
: _callback_insert(std::forward<_FTy>(callback_insert)) { }
// TODO Accept only correct callbacks
template <typename _CTy>
Continuable<Callback<_ATy...>> then(_CTy&&)
{
// TODO Transmute the returned callback here.
return Continuable<Callback<_ATy...>>(std::move(*this));
}
};

View File

@ -42,11 +42,14 @@ int main(int /*argc*/, char** /*argv*/)
test_unwrap<std::function<void()>>("std::function<void()>");
test_unwrap<std::vector<std::string>>("std::vector<std::string>");
auto voidcontinue = make_continuable([=](Callback<>&& /*callback*/)
make_continuable([=](Callback<>&& /*callback*/)
{
});
int i = 0;
++i;
auto lam = [=](Callback<SpellCastResult>&& /*callback*/)
{
// on success call the callback with SPELL_FAILED_SUCCESS
@ -95,6 +98,8 @@ int main(int /*argc*/, char** /*argv*/)
});
CastSpell(63362);
std::vector<int> myvec;
typedef fu::requires_functional_constructible<std::function<void()>>::type test_assert1;