StrongId Struct Template
A strongly-typed identifier using tag-based type safety. More...
Declaration
Friends Index
template <typename Tag> | |
| bool | operator== |
|
Equality comparison. More... | |
Public Constructors Index
template <typename Tag> | |
| constexpr | StrongId (const std::string_view str) noexcept |
|
Constructs from a compile-time string. More... | |
template <typename Tag> | |
| constexpr | StrongId (const StrongId_t id) noexcept |
|
Constructs from a raw underlying value. More... | |
template <typename Tag> | |
| constexpr | StrongId (no_init_t) |
|
Constructs an uninitialized ID. More... | |
template <typename Tag> | |
| constexpr | StrongId () |
|
Default constructor creating an uninitialized ID. More... | |
Public Operators Index
template <typename Tag> | |
| operator bool () const noexcept | |
|
Checks if the ID is valid (non-zero). More... | |
template <typename Tag> | |
| constexpr bool | operator< (const StrongId &other) const noexcept |
|
Less-than comparison for ordering. More... | |
template <typename Tag> | |
| constexpr bool | operator> (const StrongId &other) const noexcept |
|
Greater-than comparison for ordering. More... | |
Public Member Functions Index
template <typename Tag> | |
| bool | isValid () const noexcept |
|
Returns true if the strong id is considered valid. More... | |
template <typename Tag> | |
| StrongId_t | value () const noexcept |
|
Returns the underlying ID value. More... | |
Private Member Attributes Index
template <typename Tag> | |
| StrongId_t | id_ {} |
|
The underlying ID value. More... | |
Description
A strongly-typed identifier using tag-based type safety.
Provides compile-time type safety for identifiers by associating each ID type with a unique tag struct. Supports compile-time string hashing via FNV-1a algorithm.
- Template Parameters
-
Tag Empty struct used to distinguish different ID types.
Definition at line 27 of file StrongId.ixx.
Public Constructors
StrongId()
| inline explicit constexpr noexcept |
Constructs from a compile-time string.
Uses FNV-1a hashing to convert the string to an ID.
- Parameters
-
str The string to hash.
Definition at line 45 of file StrongId.ixx.
Referenced by helios::core::types::StrongId< Tag >::operator<, helios::core::types::StrongId< Tag >::operator==, helios::core::types::StrongId< Tag >::operator> and helios::core::types::StrongId< Tag >::StrongId.
StrongId()
| inline explicit constexpr noexcept |
Constructs from a raw underlying value.
- Parameters
-
id The raw ID value.
Definition at line 54 of file StrongId.ixx.
StrongId()
| inline explicit constexpr |
Constructs an uninitialized ID.
- Parameters
-
<a href="/docs/helios/structs/helios/core/types/no-init-t">no_init_t</a> Tag type indicating no initialization.
Definition at line 63 of file StrongId.ixx.
StrongId()
| inline explicit constexpr |
Default constructor creating an uninitialized ID.
Definition at line 68 of file StrongId.ixx.
References helios::core::types::no_init and helios::core::types::StrongId< Tag >::StrongId.
Public Operators
operator bool()
| inline explicit nodiscard noexcept |
Checks if the ID is valid (non-zero).
- Returns
True if the ID is non-zero.
Definition at line 93 of file StrongId.ixx.
operator<()
| inline constexpr noexcept |
Less-than comparison for ordering.
- Parameters
-
other The other ID to compare.
- Returns
True if this ID is less than the other.
Definition at line 109 of file StrongId.ixx.
operator>()
| inline constexpr noexcept |
Greater-than comparison for ordering.
- Parameters
-
other The other ID to compare.
- Returns
True if this ID is greater than the other.
Definition at line 120 of file StrongId.ixx.
Public Member Functions
isValid()
| inline nodiscard noexcept |
Returns true if the strong id is considered valid.
- Returns
True if the StrongId is considered valid, else false.
Definition at line 75 of file StrongId.ixx.
value()
| inline nodiscard noexcept |
Returns the underlying ID value.
- Returns
The raw underlying value.
Definition at line 84 of file StrongId.ixx.
Private Member Attributes
id_
|
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.