Skip to content

Commit b4b6fc0

Browse files
committed
feat: ref issue for callback
1 parent 2cb2b41 commit b4b6fc0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pc/callback/CallbackManager.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ struct function_traits<R (C::*)(Args...) const> {
3535
using args_type = std::tuple<Args...>;
3636
};
3737

38+
template <typename C, typename R, typename... Args>
39+
struct function_traits<R (C::*)(Args...)> {
40+
using args_type = std::tuple<Args...>;
41+
};
42+
3843
template <typename T>
3944
struct function_traits : public function_traits<decltype(&T::operator())> {};
4045

@@ -86,7 +91,7 @@ class CallbackManager {
8691
}
8792

8893
template <typename Callable, typename... Args>
89-
void deduce_and_register(const std::string& name, Callable&& c, int p, std::tuple<Args...>) {
94+
void deduce_and_register(const std::string& name, Callable&& c, int p, std::tuple<Args...>*) {
9095
std::function<void(Args...)> f = std::forward<Callable>(c);
9196
register_impl<Args...>(name, std::move(f), p);
9297
}
@@ -108,7 +113,7 @@ class CallbackManager {
108113
void addCallback(const std::string& name, Callable&& cb, int priority = 0) {
109114
using traits = function_traits<std::decay_t<Callable>>;
110115
using ArgsT = typename traits::args_type;
111-
deduce_and_register(name, std::forward<Callable>(cb), priority, ArgsT{});
116+
deduce_and_register(name, std::forward<Callable>(cb), priority, (ArgsT*)nullptr);
112117
}
113118

114119
template <typename... Args>

0 commit comments

Comments
 (0)