Function valid

Synopsis

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

bool valid(const entity_type entity) const

Description

Checks if an entity identifier refers to a valid entity.

Parameters

entity - An entity identifier, either valid or not.

Return
True if the identifier is valid, false otherwise.

Source

Lines 363-366 in src/entt/entity/registry.hpp.

[[nodiscard]] bool valid(const entity_type entity) const {
    const auto pos = size_type(to_integral(entity) & traits_type::entity_mask);
    return (pos < entities.size() && entities[pos] == entity);
}





Add Discussion

Log in to comment