Function remove

Summary

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

(1) template <typename... Component>
    void remove(const entity_type entity)

(2) template <typename... Component, typename It>
    void remove(It first, It last)

Function overload

Synopsis

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

template <typename... Component>
void remove(const entity_type entity)

Description

Removes the given components from an entity.

Warning
Attempting to use an invalid entity or to remove a component from an entity that doesn't own it results in undefined behavior.
Template Parameters

Component - Types of components to remove.

Parameters

entity - A valid entity identifier.

Source

Lines 694-698 in src/entt/entity/registry.hpp.

template<typename... Component>
void remove(const entity_type entity) {
    ENTT_ASSERT(valid(entity));
    (assure<Component>().remove(*this, entity), ...);
}

Synopsis

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

template <typename... Component, typename It>
void remove(It first, It last)

Description

Removes the given components from all the entities in a range.

See
remove
Template Parameters

Component - Types of components to remove.

It - Type of input iterator.

Parameters

first - An iterator to the first element of the range of entities.

last - An iterator past the last element of the range of entities.

Source

Lines 710-714 in src/entt/entity/registry.hpp.

template<typename... Component, typename It>
void remove(It first, It last) {
    ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }));
    (assure<Component>().remove(*this, first, last), ...);
}





Add Discussion

Log in to comment