The function `reset()` removes all listeners which added by ScopedRemover from the dispatcher or callback list, as if the ScopedRemover object has gone out of scope.
The function `setDispatcher()` and `setCallbackList` sets the dispatcher or callback list, and reset the ScopedRemover object.
The other member functions that have the same names with the corresponding underlying class (CallbackList, EventDispatcher, or EventQueue). Those functions add listener to the dispatcher.
ScopedRemover can be used to auto disconnect listeners when the object involved in the listeners is destroyed. For example, pseudo code,
**Code with ScopedRemover**
```c++
SomeDispatcher someDispatcher;
class MyClass
{
MyClass()
{
someDispatcher.appendListener(SomeEvent, callback of myListener);
}
void myListener() {}
};
```
In above code, when the object of MyClass is destroyed and `myListener` is not removed from `someDispatcher`, when `someDispatcher` triggers `SomeEvent`, it will invoke on dangling pointer and the program will crash on segment fault.
**Code without ScopedRemover**
```c++
SomeDispatcher someDispatcher;
class MyClass
{
MyClass() : scopedRemover(someDispatcher)
{
scopedRemover.appendListener(SomeEvent, callback of myListener);
In above code, when the object of MyClass is destroyed, `myListener` is automatically removed from `someDispatcher`, `someDispatcher` will not invoke on any dangling pointer.