dispatcher::discard becomes dispatcher::clear
This commit is contained in:
@@ -107,7 +107,7 @@ delegate(42);
|
||||
```
|
||||
|
||||
Where the function type of the delegate is `void(int)` as above. It goes without
|
||||
saying that the extra arguments are silently discarded internally.<br/>v
|
||||
saying that the extra arguments are silently discarded internally.<br/>
|
||||
This is a nice-to-have feature in a lot of cases, as an example when the
|
||||
`delegate` class is used as a building block of a signal-slot system.
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
* @tparam Event Type of events to discard.
|
||||
*/
|
||||
template<typename... Event>
|
||||
void discard() {
|
||||
void clear() {
|
||||
if constexpr(sizeof...(Event) == 0) {
|
||||
std::for_each(pools.begin(), pools.end(), [](auto &&cpool) {
|
||||
cpool->clear();
|
||||
|
||||
@@ -42,11 +42,11 @@ TEST(Dispatcher, Functionalities) {
|
||||
ASSERT_EQ(receiver.cnt, 3);
|
||||
|
||||
dispatcher.enqueue<an_event>();
|
||||
dispatcher.discard<an_event>();
|
||||
dispatcher.clear<an_event>();
|
||||
dispatcher.update();
|
||||
|
||||
dispatcher.enqueue<an_event>();
|
||||
dispatcher.discard();
|
||||
dispatcher.clear();
|
||||
dispatcher.update();
|
||||
|
||||
ASSERT_EQ(receiver.cnt, 3);
|
||||
|
||||
Reference in New Issue
Block a user