ECSM v0.2.0
ID< T >final

Item identifier in the LinearPool. More...

#include <linear-pool.hpp>

Public Member Functions

template<class U >
constexpr ID (ID< U > id) noexcept
 Changes the type of the identifier item.
 
uint32_t operator* () const noexcept
 Returns item index + 1 in the linear pool.
 
uint32_t & operator* () noexcept
 Returns reference to the item index + 1 in the linear pool.
 
constexpr bool operator== (ID v) const noexcept
 Returns true if this identifier is equal to the v identifier.
 
constexpr bool operator!= (ID v) const noexcept
 Returns true if this identifier is not equal to the v identifier.
 
constexpr bool operator< (ID v) const noexcept
 Returns true if this identifier is less than the v identifier.
 
constexpr operator bool () const noexcept
 Returns true if item is not null.
 

Friends

class LinearPool< T, true >
 
class LinearPool< T, false >
 

Detailed Description

template<class T>
struct ecsm::ID< T >

Item identifier in the LinearPool.

Template Parameters
Ttype of the item in the linear pool

Identifier or index associated with individual items within the pool. Each item in the pool can be uniquely identified by its identifier, which helps in managing and referencing items.

Constructor & Destructor Documentation

◆ ID()

template<class T >
template<class U >
constexpr ID ( ID< U > id)
inlineexplicitconstexprnoexcept

Changes the type of the identifier item.

Useful in cases where we need to cast item identifier type.

Template Parameters
Uis a new type of the identifier item
Parameters
iditem identifier in the linear pool

Member Function Documentation

◆ operator*() [1/2]

template<class T >
uint32_t operator* ( ) const
inlinenoexcept

Returns item index + 1 in the linear pool.

Used to get internal integer index.

◆ operator*() [2/2]

template<class T >
uint32_t & operator* ( )
inlinenoexcept

Returns reference to the item index + 1 in the linear pool.

Note
You can use it to set the identifier index value.

◆ operator==()

template<class T >
constexpr bool operator== ( ID< T > v) const
inlineconstexprnoexcept

Returns true if this identifier is equal to the v identifier.

Parameters
vother identifier value

◆ operator!=()

template<class T >
constexpr bool operator!= ( ID< T > v) const
inlineconstexprnoexcept

Returns true if this identifier is not equal to the v identifier.

Parameters
vother identifier value

◆ operator<()

template<class T >
constexpr bool operator< ( ID< T > v) const
inlineconstexprnoexcept

Returns true if this identifier is less than the v identifier.

Parameters
vother identifier value