StrongId Struct Template
A strongly-typed identifier using tag-based type safety. More...
Declaration
Friends Index
template <typename Tag, typename Underlying = uint32_t> | |
| bool | operator== |
|
Equality comparison. More... | |
Public Constructors Index
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr | StrongId (const std::string_view str) noexcept |
|
Constructs from a compile-time string. More... | |
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr | StrongId (helios::core::types::no_init_t) |
|
Constructs an uninitialized ID. More... | |
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr | StrongId () |
|
Default constructor creating an uninitialized ID. More... | |
Private Constructors Index
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr | StrongId (const Underlying id) noexcept |
|
Constructs from a raw underlying value. More... | |
Public Operators Index
template <typename Tag, typename Underlying = uint32_t> | |
| operator bool () const noexcept | |
|
Checks if the ID is valid (non-zero). More... | |
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr bool | operator< (const StrongId &other) const noexcept |
|
Less-than comparison for ordering. More... | |
template <typename Tag, typename Underlying = uint32_t> | |
| constexpr bool | operator> (const StrongId &other) const noexcept |
|
Greater-than comparison for ordering. More... | |
Public Member Functions Index
template <typename Tag, typename Underlying = uint32_t> | |
| Underlying | value () const noexcept |
|
Returns the underlying ID value. More... | |
Private Member Attributes Index
template <typename Tag, typename Underlying = uint32_t> | |
| Underlying | 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.
Underlying The underlying integral type (default: uint32_t).
Definition at line 28 of file StrongId.ixx.
Friends
operator==
| constexpr noexcept default |
Equality comparison.
Definition at line 92 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 56 of file StrongId.ixx.
StrongId()
| inline explicit constexpr |
Constructs an uninitialized ID.
- Parameters
-
no_init_t Tag type indicating no initialization.
Definition at line 64 of file StrongId.ixx.
StrongId()
| inline explicit constexpr |
Private Constructors
StrongId()
| inline explicit constexpr noexcept |
Constructs from a raw underlying value.
- Parameters
-
id The raw ID value.
Definition at line 43 of file StrongId.ixx.
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 85 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 101 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 112 of file StrongId.ixx.
Public Member Functions
value()
| inline nodiscard noexcept |
Returns the underlying ID value.
- Returns
The raw underlying value.
Definition at line 76 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.