struct ecs::TEntity

template<typename Type>

Represents a single entity in the ECS system.

Each entity can have zero or multiple components associated with it. Each entity has a unique identifier and a version field. Version field gets incremented if an entity is destroyed and then its identifier gets re-used.

Template parameters

Type

Backing type for the entity, normally 32-bit or 64-bit unsigned integer. Use a larger integer if you require larger number of entities.

Public

Constructors

TEntity<Type>

TEntity<Type>() = default

TEntity<Type>

constexpr TEntity<Type>(IdentifierType identifier, VersionType version)

Methods

GetIdentifier

constexpr IdentifierType GetIdentifier() const

Returns the unique identifier of the entity.

GetVersion

constexpr VersionType GetVersion() const

Returns the current version of the entity.

This will be incremented each time an entity is destroyed and its identifier gets re-used.

GetAsNextVersion

constexpr TEntity<Type> GetAsNextVersion() const

Returns the entity with the same identifier, but with the version incremented by one.

GenerateHash

u64 GenerateHash() const

Returns a hash value for this entity.

Operators

operator==

bool operator==(TEntity<Type> other) const

operator!=

bool operator!=(TEntity<Type> other) const

operator<

bool operator<(TEntity<Type> other) const