LinearLookupStrategy Class
Lookup strategy using a flat vector with linear scan. More...
Declaration
Public Constructors Index
| LinearLookupStrategy (const size_t capacity) | |
|
Constructs a strategy with pre-allocated capacity. More... | |
Public Member Functions Index
| bool | remove (const StrongId_t id) |
|
Removes a strong ID using swap-and-pop. More... | |
| bool | add (const StrongId_t id) |
|
Registers a strong ID. More... | |
| bool | has (const StrongId_t id) const |
|
Checks whether a strong ID is registered. More... | |
Private Member Attributes Index
| std::vector< StrongId_t > | strongIds_ |
|
Vector of registered strong IDs. More... | |
Description
Lookup strategy using a flat vector with linear scan.
`LinearLookupStrategy` stores strong IDs in a contiguous vector and performs linear scans for membership tests. Swap-and-pop is used for O(1) removal. Suitable for small registries where hash overhead is undesirable.
- See Also
- See Also
Definition at line 29 of file LinearLookupStrategy.ixx.
Public Constructors
LinearLookupStrategy()
| inline explicit |
Constructs a strategy with pre-allocated capacity.
- Parameters
-
capacity The initial capacity to reserve.
Definition at line 43 of file LinearLookupStrategy.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 82 of file LinearLookupStrategy.ixx.
Reference has.
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 97 of file LinearLookupStrategy.ixx.
Referenced by add.
remove()
| inline nodiscard |
Removes a strong ID using swap-and-pop.
- Parameters
-
id The strong ID to remove.
- Returns
True if removed, false if not found.
Definition at line 54 of file LinearLookupStrategy.ixx.
Private Member Attributes
strongIds_
|
Vector of registered strong IDs.
Definition at line 34 of file LinearLookupStrategy.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.