dispatcher/emitter: constrained assure
This commit is contained in:
4
TODO
4
TODO
@@ -25,9 +25,11 @@
|
||||
|
||||
* Mission: get rid of named types
|
||||
- make it possible to use custom generators (eg for plugins)
|
||||
* dispatcher, emitter, registry
|
||||
* registry
|
||||
* meta: use type_id, remove import, everything should work transparently
|
||||
* type_id_enabled and fallback on old-fashioned families otherwise
|
||||
* add discard pool functionality (+ test)
|
||||
- use type_id also for groups, get rid of extent and subfunctions, is it possible?
|
||||
- reintroduce old-fashion family and add a new family-like thing with generators
|
||||
- families should be defined as out-of-class to guarantee the same identifiers for the same types
|
||||
- update doc: family, dispatcher, emitter, registry, meta, across boundaries
|
||||
|
||||
@@ -81,6 +81,7 @@ class dispatcher {
|
||||
|
||||
template<typename Event>
|
||||
pool_handler<Event> & assure() {
|
||||
static_assert(std::is_same_v<Event, std::decay_t<Event>>);
|
||||
static std::size_t index{pools.size()};
|
||||
|
||||
if(!(index < pools.size()) || pools[index]->id() != type_id_v<Event>) {
|
||||
@@ -192,7 +193,7 @@ public:
|
||||
cpool->clear();
|
||||
});
|
||||
} else {
|
||||
(assure<std::decay_t<Event>>().clear(), ...);
|
||||
(assure<Event>().clear(), ...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ class emitter {
|
||||
|
||||
template<typename Event>
|
||||
const pool_handler<Event> & assure() const {
|
||||
static_assert(std::is_same_v<Event, std::decay_t<Event>>);
|
||||
static std::size_t index{pools.size()};
|
||||
|
||||
if(!(index < pools.size()) || pools[index]->id() != type_id_v<Event>) {
|
||||
|
||||
Reference in New Issue
Block a user