The FixedMap class provides a map implementation which allows for insertion, querying, and deletion in constant time. While std::unordered_set may give constant time complexity of these operations through a hash table, this does so through fixed size dense vector (no hashing), and store the data in a contiguous chunk of memory.
More...
#include <FixedMap.hpp>
|
| | FixedMap (size_t const size) |
| | Create a new empty fixed set. More...
|
| |
| bool | has (K const key) const noexcept |
| | Check if an key exists in this set. More...
|
| |
| V | get (K const key) const noexcept |
| | Get the value associated with a given key. More...
|
| |
| void | add (K const key, V const value) noexcept |
| | Add an key-value pair to this set. More...
|
| |
| void | remove (K const key) noexcept |
| | Remove an key-value pair from this set. More...
|
| |
| size_t | size () const noexcept |
| | Get the number of elements in the set. More...
|
| |
| size_t | maxSize () const noexcept |
| | Get the maximum size of this map. More...
|
| |
| ConstArray< K > | keys () const noexcept |
| | Get the keys in this map. More...
|
| |
| ConstArray< V > | values () const noexcept |
| | Get the values in this map. More...
|
| |
|
|
static constexpr K const | NULL_INDEX = static_cast<K>(-1) |
| |
template<typename K, typename V>
class sl::FixedMap< K, V >
The FixedMap class provides a map implementation which allows for insertion, querying, and deletion in constant time. While std::unordered_set may give constant time complexity of these operations through a hash table, this does so through fixed size dense vector (no hashing), and store the data in a contiguous chunk of memory.
- Template Parameters
-
| K | The key type, must an integer. |
| V | The value type, must be trivial. |
◆ FixedMap()
template<typename K , typename V >
Create a new empty fixed set.
- Parameters
-
◆ add()
template<typename K , typename V >
| void sl::FixedMap< K, V >::add |
( |
K const |
key, |
|
|
V const |
value |
|
) |
| |
|
inlinenoexcept |
Add an key-value pair to this set.
- Parameters
-
| key | The key. |
| value | The value. |
◆ get()
template<typename K , typename V >
Get the value associated with a given key.
- Parameters
-
- Returns
- The value.
◆ has()
template<typename K , typename V >
Check if an key exists in this set.
- Parameters
-
- Returns
- True if the key is in the map.
◆ keys()
template<typename K , typename V >
Get the keys in this map.
- Returns
- The keys.
◆ maxSize()
template<typename K , typename V >
Get the maximum size of this map.
- Returns
- The maximum size.
◆ remove()
template<typename K , typename V >
Remove an key-value pair from this set.
- Parameters
-
◆ size()
template<typename K , typename V >
Get the number of elements in the set.
- Returns
- The number of elements.
◆ values()
template<typename K , typename V >
Get the values in this map.
- Returns
- The values.
The documentation for this class was generated from the following file: