@@ -53,9 +53,10 @@ namespace ereignis
5353 template <typename R, typename ... Ts>
5454 struct listener <R(Ts...), true >
5555 {
56- std::move_only_function<R(Ts...)> func ;
56+ using callback = std::move_only_function<R(Ts...)>;
5757
5858 public:
59+ callback func;
5960 bool clearable{true };
6061 };
6162
@@ -110,20 +111,20 @@ namespace ereignis
110111 }
111112
112113 template <auto Id, typename R, typename ... Ts>
113- void event<Id, R(Ts...)>::once(listener l )
114+ void event<Id, R(Ts...)>::once(listener::callback cb )
114115 {
115116 auto lock = std::lock_guard{m_mutex};
116117 auto id = m_counter++;
117118
118- l. func = [this , state = std::make_tuple (id, std::move (l. func ))]<typename ... Us>(Us &&...args ) mutable
119+ auto wrapper = [this , state = std::make_tuple (id, std::move (cb ))]<typename ... Us>(Us &&...args ) mutable
119120 {
120- auto [id, func ] = std::move (state);
121+ auto [id, cb ] = std::move (state);
121122
122123 remove (id);
123- return std::invoke (func , std::forward<Us>(args)...);
124+ return std::invoke (cb , std::forward<Us>(args)...);
124125 };
125126
126- m_listeners.emplace (id, std::make_shared<listener>(std::move (l )));
127+ m_listeners.emplace (id, std::make_shared<listener>(std::move (wrapper )));
127128 }
128129
129130 template <auto Id, typename R, typename ... Ts>
0 commit comments