mirror of
https://github.com/Naios/continuable.git
synced 2026-02-10 20:29:49 +08:00
fix some wrong releases
This commit is contained in:
parent
b2050727c4
commit
b5c3d7d0a8
@ -59,11 +59,16 @@ public:
|
|||||||
|
|
||||||
/// Move construct
|
/// Move construct
|
||||||
template <typename _RCTy, typename _RState>
|
template <typename _RCTy, typename _RState>
|
||||||
Continuable(Continuable<_RCTy, _RState>&& right) : released(false)
|
Continuable(Continuable<_RCTy, _RState>&& right) : released(right.released)
|
||||||
{
|
{
|
||||||
right.released = true;
|
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.
|
/// Destructor which calls the dispatch chain if needed.
|
||||||
~Continuable()
|
~Continuable()
|
||||||
{
|
{
|
||||||
@ -87,13 +92,11 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _FTy>
|
// TODO Accept only correct callbacks
|
||||||
Continuable(_FTy&& callback_insert)
|
|
||||||
: _callback_insert(std::forward<_FTy>(callback_insert)) { }
|
|
||||||
|
|
||||||
template <typename _CTy>
|
template <typename _CTy>
|
||||||
Continuable<Callback<_ATy...>> then(_CTy&&)
|
Continuable<Callback<_ATy...>> then(_CTy&&)
|
||||||
{
|
{
|
||||||
|
// TODO Transmute the returned callback here.
|
||||||
return Continuable<Callback<_ATy...>>(std::move(*this));
|
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::function<void()>>("std::function<void()>");
|
||||||
test_unwrap<std::vector<std::string>>("std::vector<std::string>");
|
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*/)
|
auto lam = [=](Callback<SpellCastResult>&& /*callback*/)
|
||||||
{
|
{
|
||||||
// on success call the callback with SPELL_FAILED_SUCCESS
|
// 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;
|
std::vector<int> myvec;
|
||||||
|
|
||||||
typedef fu::requires_functional_constructible<std::function<void()>>::type test_assert1;
|
typedef fu::requires_functional_constructible<std::function<void()>>::type test_assert1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user