mirror of
https://github.com/Naios/continuable.git
synced 2026-02-07 02:09:46 +08:00
codestyle
This commit is contained in:
parent
4ede0797bc
commit
7a4dafd47e
@ -192,8 +192,12 @@ public:
|
|||||||
/// Waits for this continuable and invokes the given callback.
|
/// Waits for this continuable and invokes the given callback.
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
auto then(_CTy&& functional)
|
auto then(_CTy&& functional)
|
||||||
-> typename std::enable_if<!detail::is_continuable<typename std::decay<_CTy>::type>::value,
|
-> typename std::enable_if<
|
||||||
typename detail::unary_chainer_t<_CTy>::result_t>::type
|
!detail::is_continuable<
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::value,
|
||||||
|
typename detail::unary_chainer_t<_CTy>::result_t
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
// Transfer the insert function to the local scope.
|
// Transfer the insert function to the local scope.
|
||||||
// Also use it as an r-value reference to try to get move semantics with c++11 lambdas.
|
// Also use it as an r-value reference to try to get move semantics with c++11 lambdas.
|
||||||
@ -215,8 +219,12 @@ public:
|
|||||||
/// Waits for this continuable and continues with the given one.
|
/// Waits for this continuable and continues with the given one.
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
auto then(_CTy&& continuable)
|
auto then(_CTy&& continuable)
|
||||||
-> typename std::enable_if<detail::is_continuable<typename std::decay<_CTy>::type>::value,
|
-> typename std::enable_if<
|
||||||
typename std::decay<_CTy>::type>::type
|
detail::is_continuable<
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::value,
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
static_assert(std::is_rvalue_reference<_CTy&&>::value,
|
static_assert(std::is_rvalue_reference<_CTy&&>::value,
|
||||||
"Given continuable must be passed as r-value!");
|
"Given continuable must be passed as r-value!");
|
||||||
@ -371,6 +379,9 @@ namespace detail
|
|||||||
>::wrap(std::forward<_CTy>(functional));
|
>::wrap(std::forward<_CTy>(functional));
|
||||||
return detail::functional_corrector<_CTy>::correct(std::forward<_CTy>(functional));
|
return detail::functional_corrector<_CTy>::correct(std::forward<_CTy>(functional));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
/// Route continuable returning functionals through.
|
/// Route continuable returning functionals through.
|
||||||
template <typename _CTy>
|
template <typename _CTy>
|
||||||
@ -389,8 +400,14 @@ namespace detail
|
|||||||
/// Wrap continuables into the continuable returning functional type.
|
/// Wrap continuables into the continuable returning functional type.
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
static auto box_continuable_trait(_CTy&& continuable)
|
static auto box_continuable_trait(_CTy&& continuable)
|
||||||
-> typename std::enable_if<detail::is_continuable<typename std::decay<_CTy>::type>::value,
|
-> typename std::enable_if<
|
||||||
std::function<typename std::decay<_CTy>::type(_ATy...)>>::type
|
detail::is_continuable<
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::value,
|
||||||
|
std::function<
|
||||||
|
typename std::decay<_CTy>::type(_ATy...)
|
||||||
|
>
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
// Trick C++11 lambda capture rules for non copyable but moveable continuables.
|
// Trick C++11 lambda capture rules for non copyable but moveable continuables.
|
||||||
std::shared_ptr<typename std::decay<_CTy>::type> shared_continuable =
|
std::shared_ptr<typename std::decay<_CTy>::type> shared_continuable =
|
||||||
@ -406,8 +423,12 @@ namespace detail
|
|||||||
/// Route functionals through and forward to remove_void_trait
|
/// Route functionals through and forward to remove_void_trait
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
static auto box_continuable_trait(_CTy&& continuable)
|
static auto box_continuable_trait(_CTy&& continuable)
|
||||||
-> typename std::enable_if<!detail::is_continuable<typename std::decay<_CTy>::type>::value,
|
-> typename std::enable_if<
|
||||||
typename std::decay<_CTy>::type>::type
|
!detail::is_continuable<
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::value,
|
||||||
|
typename std::decay<_CTy>::type
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
return continuable;
|
return continuable;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user