in Source/Shared/arcana/messaging/router.h [124:150]
void internal_remove_listener(const ticket_seed& id)
{
GSL_CONTRACT_CHECK("thread affinity", m_affinity.check());
using event = std::decay_t<EventT>;
auto& listeners = std::get<listener_group<event>>(m_listeners);
auto found = std::find_if(listeners.begin(), listeners.end(), [id](const listener<event>& listener) {
return listener.id == id;
});
if (found == listeners.end())
{
assert(false && "removing item that isn't there");
return;
}
// don't modify the collection while iterating, just disable the listener
if (std::get<sentry<event>>(m_sentries).is_active())
{
found->valid = false;
}
else
{
listeners.erase(found);
}
}