mirror of
https://github.com/Naios/continuable.git
synced 2026-02-12 13:19:49 +08:00
fix codestyle
This commit is contained in:
parent
6dc592ad6b
commit
d2f6f1f4b0
@ -58,24 +58,24 @@ namespace detail
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
struct WeakProxyFactory<std::weak_ptr<std::function<void(Args...)>>>
|
struct WeakProxyFactory<std::weak_ptr<std::function<void(Args...)>>>
|
||||||
{
|
{
|
||||||
static Callback<Args...> CreateProxy(WeakCallback<Args...> const& weak)
|
static Callback<Args...> CreateProxy(WeakCallback<Args...> const& weak)
|
||||||
{
|
{
|
||||||
return [=](Args&&... args)
|
return [=](Args&&... args)
|
||||||
{
|
{
|
||||||
if (auto const callback = weak.lock())
|
if (auto const callback = weak.lock())
|
||||||
// FIXME: use std::forward
|
// FIXME: use std::forward
|
||||||
(*callback)(args...);
|
(*callback)(args...);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
struct WeakProxyFactory<std::shared_ptr<std::function<void(Args...)>>>
|
struct WeakProxyFactory<std::shared_ptr<std::function<void(Args...)>>>
|
||||||
{
|
{
|
||||||
static Callback<Args...> CreateProxy(SharedCallback<Args...> const& shared)
|
static Callback<Args...> CreateProxy(SharedCallback<Args...> const& shared)
|
||||||
{
|
{
|
||||||
return WeakProxyFactory<std::weak_ptr<std::function<void(Args...)>>>::CreateProxy(shared);
|
return WeakProxyFactory<std::weak_ptr<std::function<void(Args...)>>>::CreateProxy(shared);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
@ -97,7 +97,7 @@ inline shared_callback_of_t<_CTy>
|
|||||||
(std::forward<callback_of_t<_CTy>>(callback));
|
(std::forward<callback_of_t<_CTy>>(callback));
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Creates a weak callback which wrapps the given shared or weak callback.
|
/// Creates a weak callback which wraps the given shared or weak callback.
|
||||||
/// If the given managed callback expires the callback is not invoked anymore.
|
/// If the given managed callback expires the callback is not invoked anymore.
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
inline auto make_weak_wrapped_callback(_CTy const& callback)
|
inline auto make_weak_wrapped_callback(_CTy const& callback)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user