Update Notification class to allow for easier reference to the handler type
This commit is contained in:
parent
7a9dc1d93d
commit
916f589344
1 changed files with 5 additions and 3 deletions
|
@ -5,16 +5,18 @@
|
||||||
template <class... notifyData>
|
template <class... notifyData>
|
||||||
class Notification{
|
class Notification{
|
||||||
public:
|
public:
|
||||||
|
typedef std::function<void(notifyData...)> HandlerTy;
|
||||||
|
|
||||||
Notification() = default;
|
Notification() = default;
|
||||||
void onNotify(std::function<void(notifyData...)> aHandler);
|
void onNotify(HandlerTy aHandler);
|
||||||
void notify(notifyData... notifySendData);
|
void notify(notifyData... notifySendData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::function<void(notifyData...)>> mFunctionHandlers;
|
std::vector<HandlerTy> mFunctionHandlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class... handlerData>
|
template <class... handlerData>
|
||||||
void Notification<handlerData...>::onNotify(std::function<void(handlerData...)> aHandler){
|
void Notification<handlerData...>::onNotify(HandlerTy aHandler){
|
||||||
mFunctionHandlers.push_back(std::move(aHandler));
|
mFunctionHandlers.push_back(std::move(aHandler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue