Update Notification class to allow for easier reference to the handler type

This commit is contained in:
Matthew Colvin 2023-08-14 20:04:27 -05:00 committed by MatthewColvin
parent 7a9dc1d93d
commit 916f589344

View file

@ -5,16 +5,18 @@
template <class... notifyData>
class Notification{
public:
typedef std::function<void(notifyData...)> HandlerTy;
Notification() = default;
void onNotify(std::function<void(notifyData...)> aHandler);
void onNotify(HandlerTy aHandler);
void notify(notifyData... notifySendData);
private:
std::vector<std::function<void(notifyData...)>> mFunctionHandlers;
std::vector<HandlerTy> mFunctionHandlers;
};
template <class... handlerData>
void Notification<handlerData...>::onNotify(std::function<void(handlerData...)> aHandler){
void Notification<handlerData...>::onNotify(HandlerTy aHandler){
mFunctionHandlers.push_back(std::move(aHandler));
}