group: make types explicit for the next/prev functions

This commit is contained in:
Michele Caini
2023-03-29 17:36:31 +02:00
parent 645edfb2b8
commit 1646217f09
2 changed files with 13 additions and 12 deletions

View File

@@ -154,18 +154,14 @@ public:
}
}
void previous(const void *elem) {
if(elem) {
std::apply([this, elem](auto *...cpool) { ((cpool->on_destroy().disconnect(this), cpool->on_destroy().before(elem).template connect<&group_handler::remove_if>(*this)), ...); }, pools);
std::apply([this, elem](auto *...cpool) { ((cpool->on_construct().disconnect(this), cpool->on_construct().before(elem).template connect<&group_handler::remove_if>(*this)), ...); }, filter);
}
void previous(const owning_group_descriptor &elem) {
std::apply([this, &elem](auto *...cpool) { ((cpool->on_destroy().disconnect(this), cpool->on_destroy().before(&elem).template connect<&group_handler::remove_if>(*this)), ...); }, pools);
std::apply([this, &elem](auto *...cpool) { ((cpool->on_construct().disconnect(this), cpool->on_construct().before(&elem).template connect<&group_handler::remove_if>(*this)), ...); }, filter);
}
void next(const void *elem) {
if(elem) {
std::apply([this, elem](auto *...cpool) { ((cpool->on_construct().disconnect(this), cpool->on_construct().before(elem).template connect<&group_handler::push_on_construct>(*this)), ...); }, pools);
std::apply([this, elem](auto *...cpool) { ((cpool->on_destroy().disconnect(this), cpool->on_destroy().before(elem).template connect<&group_handler::push_on_destroy>(*this)), ...); }, filter);
}
void next(const owning_group_descriptor &elem) {
std::apply([this, &elem](auto *...cpool) { ((cpool->on_construct().disconnect(this), cpool->on_construct().before(&elem).template connect<&group_handler::push_on_construct>(*this)), ...); }, pools);
std::apply([this, &elem](auto *...cpool) { ((cpool->on_destroy().disconnect(this), cpool->on_destroy().before(&elem).template connect<&group_handler::push_on_destroy>(*this)), ...); }, filter);
}
[[nodiscard]] std::size_t length() const noexcept {

View File

@@ -1247,8 +1247,13 @@ public:
}
}
handler->previous(prev);
handler->next(next);
if(prev) {
handler->previous(*prev);
}
if(next) {
handler->next(*next);
}
return {*handler};
}