mirror of
https://github.com/Naios/continuable.git
synced 2026-02-06 17:59:47 +08:00
some more work
This commit is contained in:
parent
8534dbb8ac
commit
64391c2efb
@ -48,16 +48,17 @@ namespace detail
|
|||||||
{
|
{
|
||||||
typedef _ContinuableImpl<DefaultContinuableState, Callback<>> type;
|
typedef _ContinuableImpl<DefaultContinuableState, Callback<>> type;
|
||||||
|
|
||||||
|
template<typename Fn, typename... Args>
|
||||||
|
static type invoke(Fn functional, Args... args)
|
||||||
|
{
|
||||||
|
// Invoke the void returning functional
|
||||||
|
functional(std::forward<Args>(args)...);
|
||||||
|
|
||||||
//template<typename Fn, typename... Args>
|
// Return a fake void continuable
|
||||||
//static type InvokeAndReturn(std::function<Fn> const& functional, std::forward<Args>... args)
|
return type([](Callback<>&&)
|
||||||
//{
|
{
|
||||||
// functional(std::forward<Args>(args)...);
|
});
|
||||||
// return type(); /*[](Callback<>&& callback)
|
}
|
||||||
// {
|
|
||||||
// callback();
|
|
||||||
// });*/
|
|
||||||
//}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _State, typename _CTy>
|
template<typename _State, typename _CTy>
|
||||||
@ -65,11 +66,11 @@ namespace detail
|
|||||||
{
|
{
|
||||||
typedef _ContinuableImpl<_State, _CTy> type;
|
typedef _ContinuableImpl<_State, _CTy> type;
|
||||||
|
|
||||||
//template<typename Fn, typename... Args>
|
template<typename Fn, typename... Args>
|
||||||
//static type InvokeAndReturn(std::function<Fn> const& functional, std::forward<Args>... args)
|
static type invoke(Fn functional, Args... args)
|
||||||
//{
|
{
|
||||||
// return functional(std::forward<Args>(args)...);
|
return functional(std::forward<Args>(args)...);
|
||||||
//}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _NextRTy, typename... _NextATy>
|
template<typename _NextRTy, typename... _NextATy>
|
||||||
@ -79,6 +80,8 @@ namespace detail
|
|||||||
template<typename _NextRTy, typename... _NextATy>
|
template<typename _NextRTy, typename... _NextATy>
|
||||||
struct unary_chainer<_NextRTy, fu::identity<_NextATy...>>
|
struct unary_chainer<_NextRTy, fu::identity<_NextATy...>>
|
||||||
{
|
{
|
||||||
|
typedef convert_void_to_continuable<_NextRTy> base;
|
||||||
|
|
||||||
typedef typename convert_void_to_continuable<_NextRTy>::type result_t;
|
typedef typename convert_void_to_continuable<_NextRTy>::type result_t;
|
||||||
|
|
||||||
typedef typename result_t::CallbackFunction callback_t;
|
typedef typename result_t::CallbackFunction callback_t;
|
||||||
@ -182,14 +185,14 @@ namespace detail
|
|||||||
ForwardFunction&& callback = std::move(_callback_insert);
|
ForwardFunction&& callback = std::move(_callback_insert);
|
||||||
|
|
||||||
return typename unary_chainer_t<_CTy>::result_t(
|
return typename unary_chainer_t<_CTy>::result_t(
|
||||||
[functional, callback](typename unary_chainer_t<_CTy>::callback_t&& next)
|
[functional, callback](unary_chainer_t<_CTy>::callback_t&& call_next)
|
||||||
{
|
{
|
||||||
callback([functional, next](_ATy... args)
|
callback([functional, call_next](_ATy&&... args)
|
||||||
{
|
{
|
||||||
typename unary_chainer_t<_CTy>::result_t continuable;
|
unary_chainer_t<_CTy>::result_t continuable =
|
||||||
//= next(std::forward<_ATy>(args)...);
|
unary_chainer_t<_CTy>::base::invoke(functional, std::forward<_ATy>(args)...);
|
||||||
|
|
||||||
// continuable();
|
// continuable._callback_insert(std::move(call_next));
|
||||||
});
|
});
|
||||||
|
|
||||||
}, std::move(*this));
|
}, std::move(*this));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user