mirror of
https://github.com/Naios/continuable.git
synced 2025-12-07 17:26:47 +08:00
fix some wrong releases
This commit is contained in:
parent
137d5a9f19
commit
c82a721b37
@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
7
test.cpp
7
test.cpp
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user