Function current

Synopsis

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

version_type current(const entity_type entity) const

Description

Returns the actual version for an entity identifier.

Warning
Attempting to use an entity that doesn't belong to the registry results in undefined behavior. An entity belongs to the registry even if it has been previously destroyed and/or recycled.
An assertion will abort the execution at runtime in debug mode if the registry doesn't own the given entity.
Parameters:

entity - A valid entity identifier.

Return
Actual version for the given entity identifier.

Mentioned in

Source

Lines 396-400 in src/entt/entity/registry.hpp.

[[nodiscard]] version_type current(const entity_type entity) const {
    const auto pos = size_type(to_integral(entity) & traits_type::entity_mask);
    ENTT_ASSERT(pos < entities.size());
    return version_type(to_integral(entities[pos]) >> traits_type::entity_shift);
}





Add Discussion

Log in to comment