This commit is contained in:
Naios 2015-06-14 18:13:12 +02:00
parent 1550716f4b
commit eea6b78070
2 changed files with 11 additions and 16 deletions

View File

@ -26,15 +26,15 @@
#include "functional_unwrap.hpp" #include "functional_unwrap.hpp"
/// A general purpose Callback type (Callable/ Invokeable) /// A general purpose void returing callback type (`std::function<void(Args...)>`).
template<typename... Args> template<typename... Args>
using Callback = std::function<void(Args...)>; using Callback = std::function<void(Args...)>;
/// A Callback wrapped in a std::shared_ptr /// A callback wrapped in a std::shared_ptr
template<typename... Args> template<typename... Args>
using SharedCallback = std::shared_ptr<Callback<Args...>>; using SharedCallback = std::shared_ptr<Callback<Args...>>;
/// A Callback wrapped in a std::weak_ptr /// A callback wrapped in a std::weak_ptr
template<typename... Args> template<typename... Args>
using WeakCallback = std::weak_ptr<Callback<Args...>>; using WeakCallback = std::weak_ptr<Callback<Args...>>;

View File

@ -35,27 +35,25 @@ namespace detail
typedef ContinuableState<std::tuple<>, void> DefaultContinuableState; typedef ContinuableState<std::tuple<>, void> DefaultContinuableState;
// ContinuableImpl Forward definition
template<typename _STy, typename _CTy>
class _ContinuableImpl;
/// Corrects void return types from functional types which should be Continuable<Callback<>> /// Corrects void return types from functional types which should be Continuable<Callback<>>
/*
template<typename _RTy> template<typename _RTy>
struct convert_void_to_continuable; struct convert_void_to_continuable;
template<> template<>
struct convert_void_to_continuable<void> struct convert_void_to_continuable<void>
{ {
typedef Continuable<Callback<>> type; typedef _ContinuableImpl<DefaultContinuableState, Callback<>> type;
}; };
template<typename... _CArgs> template<typename _State, typename _CTy>
struct convert_void_to_continuable<Continuable<_CArgs...>> struct convert_void_to_continuable<_ContinuableImpl<_State, _CTy>>
{ {
typedef Continuable<_CArgs...> type; typedef _ContinuableImpl<_State, _CTy> type;
}; };
*/
// ContinuableImpl Forward definition
template<typename _STy, typename _CTy>
class _ContinuableImpl;
template<typename... _STy, typename... _ATy> template<typename... _STy, typename... _ATy>
class _ContinuableImpl<ContinuableState<_STy...>, std::function<void(_ATy...)>> class _ContinuableImpl<ContinuableState<_STy...>, std::function<void(_ATy...)>>
@ -64,9 +62,6 @@ namespace detail
template<typename, typename> template<typename, typename>
friend class _ContinuableImpl; friend class _ContinuableImpl;
typedef ContinuableState<_STy...> MyState;
typedef Callback<_ATy...> MyCallback;
public: public:
typedef std::function<void(Callback<_ATy...>&&)> ForwardFunction; typedef std::function<void(Callback<_ATy...>&&)> ForwardFunction;