An Id class for creating strongly-typed ID wrappers. This template provides a common interface for ID types by wrapping a value type with type-safe operations. Derived classes should implement static NullValue() and Null() methods to define null/invalid ID semantics.
More...
#include <Id.hpp>
|
| constexpr bool | IsNull (void) const |
| | Checks if the ID is null/invalid by comparing its value to the null value defined by the derived class.
|
|
| static constexpr TDerived | Null (void) |
| | Get the null value for this ID type. This should be defined by the derived class to specify what constitutes a null/invalid ID.
|
|
| TValue | value |
| | The underlying value of the ID.
|
|
| constexpr | explicit (false) BasicId(TValue value_ |
| | Constructor for BasicId. Allows implicit construction from the underlying value type, defaulting to the null value.
|
template<typename
TDerived, typename TValue>
struct Engine::BasicId< TDerived, TValue >
An Id class for creating strongly-typed ID wrappers. This template provides a common interface for ID types by wrapping a value type with type-safe operations. Derived classes should implement static NullValue() and Null() methods to define null/invalid ID semantics.
- Template Parameters
-
| TDerived | The derived class type (CRTP pattern) |
| TValue | The underlying value type for the ID (e.g., int, uint64_t, etc.) |
- Note
- Derived classes must provide:
- static constexpr TValue NullValue() - Returns the value representing a null/invalid ID
- static constexpr TDerived Null() - Returns a null instance of the derived type
◆ explicit()
template<typename
TDerived, typename TValue>
Constructor for BasicId. Allows implicit construction from the underlying value type, defaulting to the null value.
- Parameters
-
| value_ | The value to initialize the ID with. Defaults to the null value defined by the derived class. |
- Returns
- An instance of the derived ID type initialized with the given value.
◆ IsNull()
template<typename
TDerived, typename TValue>
Checks if the ID is null/invalid by comparing its value to the null value defined by the derived class.
- Returns
- True if the ID is null/invalid, false otherwise.
◆ Null()
template<typename
TDerived, typename TValue>
Get the null value for this ID type. This should be defined by the derived class to specify what constitutes a null/invalid ID.
- Returns
- The value representing a null/invalid ID for this type.
◆ TDerived
template<typename TDerived, typename TValue>
◆ value
template<typename
TDerived, typename TValue>
The underlying value of the ID.
The documentation for this struct was generated from the following files: