HashedLookupStrategy Class
Lookup strategy using an unordered set for O(1) amortized lookups. More...
Declaration
Public Constructors Index
| HashedLookupStrategy (const size_t capacity) | |
|
Constructs a strategy with pre-allocated capacity. More... | |
Public Member Functions Index
| bool | add (const StrongId_t id) |
|
Registers a strong ID. More... | |
| bool | remove (const StrongId_t id) |
|
Removes a strong ID. More... | |
| bool | has (const StrongId_t id) const |
|
Checks whether a strong ID is registered. More... | |
Private Member Attributes Index
| std::unordered_set< StrongId_t > | strongIds_ |
|
Set of registered strong IDs. More... | |
Description
Lookup strategy using an unordered set for O(1) amortized lookups.
`HashedLookupStrategy` maintains a set of registered strong IDs and provides constant-time insertion, removal, and membership tests. Used as the default lookup strategy in `EntityRegistry`.
- See Also
- See Also
Definition at line 26 of file HashedLookupStrategy.ixx.
Public Constructors
HashedLookupStrategy()
| inline explicit |
Constructs a strategy with pre-allocated capacity.
- Parameters
-
capacity The initial bucket count to reserve.
Definition at line 40 of file HashedLookupStrategy.ixx.
Public Member Functions
add()
| inline nodiscard |
Registers a strong ID.
- Parameters
-
id The strong ID to add.
- Returns
True if inserted, false if already present.
Definition at line 51 of file HashedLookupStrategy.ixx.
has()
| inline nodiscard |
Checks whether a strong ID is registered.
- Parameters
-
id The strong ID to test.
- Returns
True if the ID is present.
Definition at line 73 of file HashedLookupStrategy.ixx.
remove()
| inline nodiscard |
Removes a strong ID.
- Parameters
-
id The strong ID to remove.
- Returns
True if removed, false if not found.
Definition at line 62 of file HashedLookupStrategy.ixx.
Private Member Attributes
strongIds_
|
Set of registered strong IDs.
Definition at line 31 of file HashedLookupStrategy.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.