8 typedef std::function
<void (void)> Notifier
;
9 typedef std::list
<std::pair
<int, Notifier
> > NotifierList
;
10 typedef NotifierList::iterator NotifierHandle
;
15 void disconnect(NotifierHandle handle
) {
16 this->notifier_list
.erase(handle
);
20 NotifierHandle
connect(int type
, Notifier notifier
) {
21 NotifierList
&nl
= this->notifier_list
;
22 std::pair
<int, Notifier
> item(type
, notifier
);
23 return nl
.insert(nl
.end(), item
);
26 void notify(int event
) {
27 NotifierList
&nl
= this->notifier_list
;
28 NotifierList::iterator i
;
30 for (i
= nl
.begin(); i
!= nl
.end(); ++i
) {
31 if (i
->first
== event
) {
38 NotifierList notifier_list
;