mirror of
https://github.com/Naios/continuable.git
synced 2026-02-07 18:26:40 +08:00
some changes
This commit is contained in:
parent
005ccf4e49
commit
632c8a4d80
@ -125,14 +125,16 @@ namespace detail
|
|||||||
bool _released;
|
bool _released;
|
||||||
|
|
||||||
template <typename _CTy>
|
template <typename _CTy>
|
||||||
_ContinuableImpl& operator()(_CTy callback)
|
void invoke(_CTy&& callback)
|
||||||
{
|
{
|
||||||
// Invalidate this
|
if (!_released)
|
||||||
_released = true;
|
{
|
||||||
|
// Invalidate this
|
||||||
|
_released = true;
|
||||||
|
|
||||||
// Invoke this
|
// Invoke this
|
||||||
_callback_insert(std::forward<_CTy>(callback));
|
_callback_insert(std::forward<_CTy>(callback));
|
||||||
return *this;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pack a continuable into the continuable returning functional type.
|
// Pack a continuable into the continuable returning functional type.
|
||||||
@ -233,7 +235,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
// Invoke the next callback
|
// Invoke the next callback
|
||||||
unary_chainer_t<_CTy>::base::invoke(functional, std::forward<_ATy>(args)...)
|
unary_chainer_t<_CTy>::base::invoke(functional, std::forward<_ATy>(args)...)
|
||||||
(std::move(call_next));
|
.invoke(std::move(call_next));
|
||||||
});
|
});
|
||||||
|
|
||||||
}, std::move(*this));
|
}, std::move(*this));
|
||||||
@ -375,7 +377,7 @@ inline auto make_continuable(_FTy&& functional)
|
|||||||
/// .all(...)
|
/// .all(...)
|
||||||
/// .some(...)
|
/// .some(...)
|
||||||
/// .any(...)
|
/// .any(...)
|
||||||
inline auto empty_continuable()
|
inline auto make_continuable()
|
||||||
-> Continuable<>
|
-> Continuable<>
|
||||||
{
|
{
|
||||||
return make_continuable([](Callback<>&& callback)
|
return make_continuable([](Callback<>&& callback)
|
||||||
|
|||||||
2
test.cpp
2
test.cpp
@ -92,7 +92,7 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Mockup of aggregate methods
|
// Mockup of aggregate methods
|
||||||
empty_continuable()
|
make_continuable()
|
||||||
.all(
|
.all(
|
||||||
[] { return TrivialPromise(); },
|
[] { return TrivialPromise(); },
|
||||||
[] { return TrivialPromise(); },
|
[] { return TrivialPromise(); },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user