Function remove_all

Synopsis

#include <src/entt/entity/registry.hpp>

void remove_all(const entity_type entity)

Description

Removes all the components from an entity and makes it orphaned.

Warning
In case there are listeners that observe the destruction of components and assign other components to the entity in their bodies, the result of invoking this function may not be as expected. In the worst case, it could lead to undefined behavior.
Warning
Attempting to use an invalid entity results in undefined behavior.
Parameters

entity - A valid entity identifier.

Source

Lines 757-766 in src/entt/entity/registry.hpp.

void remove_all(const entity_type entity) {
    ENTT_ASSERT(valid(entity));
    entity_type wrap[1]{entity};
    for(auto pos = pools.size(); pos; --pos) {
        if(auto &pdata = pools[pos-1]; pdata.pool && pdata.pool->contains(entity)) {
            pdata.remove(*pdata.pool, *this, std::begin(wrap), std::end(wrap));
        }
    }
}





Add Discussion

Log in to comment