mirror of
https://github.com/Naios/continuable.git
synced 2026-02-07 18:26:40 +08:00
fix some stupid clang fails
This commit is contained in:
parent
2a1f81f233
commit
e3a22ef5d4
@ -39,8 +39,8 @@ namespace detail
|
|||||||
template<typename Function>
|
template<typename Function>
|
||||||
struct do_unwrap_callback;
|
struct do_unwrap_callback;
|
||||||
|
|
||||||
template<typename _RTy, typename... _ATy>
|
template<typename... _ATy>
|
||||||
struct do_unwrap_callback<std::function<_RTy(_ATy...)>>
|
struct do_unwrap_callback<std::function<void(_ATy...)>>
|
||||||
{
|
{
|
||||||
typedef Callback<_ATy...> CallbackType;
|
typedef Callback<_ATy...> CallbackType;
|
||||||
|
|
||||||
@ -52,6 +52,7 @@ namespace detail
|
|||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
using unwrap_callback_t = do_unwrap_callback<::fu::function_type_of_t<_CTy>>;
|
using unwrap_callback_t = do_unwrap_callback<::fu::function_type_of_t<_CTy>>;
|
||||||
|
|
||||||
|
/*
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
struct WeakProxyFactory
|
struct WeakProxyFactory
|
||||||
{
|
{
|
||||||
@ -69,8 +70,7 @@ namespace detail
|
|||||||
return CreateProxyFromWeak(WeakCallback<Args...>(shared_callback));
|
return CreateProxyFromWeak(WeakCallback<Args...>(shared_callback));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
**/
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
|
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace detail
|
|||||||
struct ContinuableFactory;
|
struct ContinuableFactory;
|
||||||
|
|
||||||
template <typename _FTy, typename _RTy, typename... _ATy>
|
template <typename _FTy, typename _RTy, typename... _ATy>
|
||||||
struct ContinuableFactory<_FTy, _RTy, ::fu::identity<Callback<_ATy...>&&>>
|
struct ContinuableFactory<_FTy, _RTy, ::fu::identity<std::function<void(_ATy...)>&&>>
|
||||||
{
|
{
|
||||||
static auto CreateFrom(_FTy&& functional)
|
static auto CreateFrom(_FTy&& functional)
|
||||||
-> Continuable<_ATy...>
|
-> Continuable<_ATy...>
|
||||||
|
|||||||
21
test.cpp
21
test.cpp
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
enum SpellCastResult
|
enum SpellCastResult
|
||||||
{
|
{
|
||||||
@ -29,9 +30,23 @@ Continuable<SpellCastResult> CastSpell(int id)
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
shared_callback_of_t<Callback<int>> sc1;
|
auto lam = [=](Callback<SpellCastResult>&& callback)
|
||||||
weak_callback_of_t<Callback<bool>> sc2;
|
{
|
||||||
|
// on success call the callback with SPELL_FAILED_SUCCESS
|
||||||
|
callback(SPELL_FAILED_SUCCESS);
|
||||||
|
};
|
||||||
|
|
||||||
|
// static_assert(std::is_void<decltype(lam)>::value, "blub");
|
||||||
|
|
||||||
|
fu::function_type_of_t<decltype(lam)> fun1;
|
||||||
|
fun1 = lam;
|
||||||
|
fun1(Callback<SpellCastResult>());
|
||||||
|
|
||||||
|
fu::function_type_of_t<Callback<int>> fun2;
|
||||||
|
|
||||||
|
shared_callback_of_t<Callback<int>> fun3;
|
||||||
|
weak_callback_of_t<Callback<int>> fun4;
|
||||||
|
|
||||||
// make_weak_wrapped_callback(sc1);
|
// make_weak_wrapped_callback(sc1);
|
||||||
// make_weak_wrapped_callback(sc2);
|
// make_weak_wrapped_callback(sc2);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user