mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
more cleanup
This commit is contained in:
parent
e69e03926d
commit
a861f16af2
@ -332,9 +332,9 @@ namespace detail
|
|||||||
struct void_wrap_trait<fu::identity<_ATy...>>
|
struct void_wrap_trait<fu::identity<_ATy...>>
|
||||||
{
|
{
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
static std::function<Continuable<>(_ATy...)> wrap(_CTy&& functional)
|
static std::function<Continuable<>(_ATy...)> wrap(_CTy&& functional_)
|
||||||
{
|
{
|
||||||
return [functional](_ATy&&... args)
|
return [functional = std::forward<_CTy>(functional_)](_ATy&&... args)
|
||||||
{
|
{
|
||||||
// Invoke the original callback
|
// Invoke the original callback
|
||||||
functional(std::forward<_ATy>(args)...);
|
functional(std::forward<_ATy>(args)...);
|
||||||
@ -354,33 +354,6 @@ namespace detail
|
|||||||
typedef Tuple tuple;
|
typedef Tuple tuple;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
template<typename _CTy, typename... _ATy>
|
|
||||||
struct continuable_returner
|
|
||||||
{
|
|
||||||
typename std::decay<_CTy>::type returning_continuable;
|
|
||||||
|
|
||||||
continuable_returner(typename std::decay<_CTy>::type&& returning_continuable_)
|
|
||||||
: returning_continuable(returning_continuable_) { }
|
|
||||||
|
|
||||||
continuable_returner(continuable_returner&) = delete;
|
|
||||||
|
|
||||||
continuable_returner& operator= (continuable_returner&) = delete;
|
|
||||||
|
|
||||||
continuable_returner& operator= (continuable_returner&& right)
|
|
||||||
{
|
|
||||||
returning_continuable = std::move(right.returning_continuable);
|
|
||||||
return *this;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto operator()(_ATy&&...)
|
|
||||||
-> typename std::decay<_CTy>::type
|
|
||||||
{
|
|
||||||
return std::move(returning_continuable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// Continuable processing detail implementation
|
/// Continuable processing detail implementation
|
||||||
template <typename... _ATy>
|
template <typename... _ATy>
|
||||||
struct functional_traits
|
struct functional_traits
|
||||||
@ -441,13 +414,13 @@ namespace detail
|
|||||||
|
|
||||||
// Trick C++11 lambda capture rules for non copyable but moveable continuables.
|
// Trick C++11 lambda capture rules for non copyable but moveable continuables.
|
||||||
// TODO Use the stack instead of heap variables.
|
// TODO Use the stack instead of heap variables.
|
||||||
std::shared_ptr<typename std::decay<_CTy>::type> shared_continuable =
|
// std::shared_ptr<typename std::decay<_CTy>::type> shared_continuable =
|
||||||
std::make_shared<typename std::decay<_CTy>::type>(std::forward<_CTy>(continuable));
|
// std::make_shared<typename std::decay<_CTy>::type>(std::forward<_CTy>(continuable));
|
||||||
|
|
||||||
// Create a fake function which returns the value on invoke.
|
// Create a fake function which returns the value on invoke.
|
||||||
return [shared_continuable](_ATy&&...)
|
return [continuable_ = std::forward<_CTy>(continuable)](_ATy&&...) mutable
|
||||||
{
|
{
|
||||||
return std::move(*shared_continuable);
|
return std::move(continuable_);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user