mirror of
https://github.com/Naios/continuable.git
synced 2026-02-16 23:29:48 +08:00
more work
This commit is contained in:
parent
41fdaaf1dd
commit
d4ea5b8be6
@ -94,6 +94,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/// Developing
|
||||||
|
Continuable() : _released(true) { }
|
||||||
|
|
||||||
/// Deleted copy construct
|
/// Deleted copy construct
|
||||||
Continuable(Continuable const&) = delete;
|
Continuable(Continuable const&) = delete;
|
||||||
|
|
||||||
@ -487,7 +491,7 @@ namespace detail
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
struct multiple_when_all_chainer_t_make_result<fu::identity<Args...>>
|
struct multiple_when_all_chainer_t_make_result<fu::identity<Args...>>
|
||||||
{
|
{
|
||||||
typedef std::function<Continuable</*Args...*/>()> type;
|
typedef Continuable<Args...> type;
|
||||||
|
|
||||||
// type create()
|
// type create()
|
||||||
};
|
};
|
||||||
@ -507,11 +511,7 @@ namespace detail
|
|||||||
static auto make_when_all(_CTy&&... args)
|
static auto make_when_all(_CTy&&... args)
|
||||||
-> typename multiple_when_all_chainer_t_make_result<arguments_t>::type
|
-> typename multiple_when_all_chainer_t_make_result<arguments_t>::type
|
||||||
{
|
{
|
||||||
return make_continuable([]()
|
return multiple_when_all_chainer_t_make_result<arguments_t>::type();
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,8 +221,8 @@ namespace fu
|
|||||||
struct invoker<sequence<Sequence...>>
|
struct invoker<sequence<Sequence...>>
|
||||||
{
|
{
|
||||||
template<typename _FTy, typename _TTy>
|
template<typename _FTy, typename _TTy>
|
||||||
static auto invoke(_FTy&& functional, _TTy&& tuple)
|
inline static auto invoke(_FTy&& functional, _TTy&& tuple)
|
||||||
-> ::fu::return_type_of_t<typename std::decay<_FTy>::type>
|
-> return_type_of_t<typename std::decay<_FTy>::type>
|
||||||
{
|
{
|
||||||
return std::forward<_FTy>(functional)(std::get<Sequence>(std::forward<_TTy>(tuple))...);
|
return std::forward<_FTy>(functional)(std::get<Sequence>(std::forward<_TTy>(tuple))...);
|
||||||
}
|
}
|
||||||
|
|||||||
13
test.cpp
13
test.cpp
@ -345,10 +345,11 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
>
|
>
|
||||||
>::result_maker::partial_results_t myres123345;
|
>::result_maker::partial_results_t myres123345;
|
||||||
|
|
||||||
detail::multiple_when_all_chainer_t<
|
auto firstType = detail::multiple_when_all_chainer_t<
|
||||||
fu::identity<>,
|
fu::identity<>,
|
||||||
fu::identity<
|
fu::identity<
|
||||||
std::function<Continuable<>()>,
|
std::function<Continuable<>()>,
|
||||||
|
std::function<Continuable<SpellCastResult>()>,
|
||||||
std::function<Continuable<SpellCastResult>()>
|
std::function<Continuable<SpellCastResult>()>
|
||||||
>
|
>
|
||||||
>::make_when_all(
|
>::make_when_all(
|
||||||
@ -358,7 +359,15 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
{
|
{
|
||||||
return CastSpellPromise(2);
|
return CastSpellPromise(10);
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
{
|
||||||
|
return CastSpellPromise(20);
|
||||||
|
})
|
||||||
|
.then([](SpellCastResult, SpellCastResult)
|
||||||
|
{
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
std::cout << "ok" << std::endl;
|
std::cout << "ok" << std::endl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user