|
auto | size () const |
| Return the number of key-value pairs in the map. More...
|
|
auto | isEmpty () const |
| Check if the map is empty. More...
|
|
Item * | begin () |
|
const Item * | begin () const |
|
Item * | end () |
|
const Item * | end () const |
|
template<typename ComparableToKey > |
bool | remove (const ComparableToKey &key) |
| Remove an item with matching key from the Map. More...
|
|
bool | insertIfNotExists (Item &&item) |
| Inserts an item if it doesn't exist already. More...
|
|
Value * | insertOverwrite (Item &&item) |
| Insert an item, overwriting the potentially already existing one. More...
|
|
Key * | insertValueUniqueKey (Value &&value) |
| Inserts a new value, automatically generating key with Key::generateUniqueKey (works for StrongID for example) More...
|
|
template<typename ComparableToKey > |
bool | contains (const ComparableToKey &key) const |
| Check if the given key is contained in the map. More...
|
|
template<typename ComparableToKey > |
bool | contains (const ComparableToKey &key, const Value *&outValue) const |
| Check if the given key is contained in the map. More...
|
|
template<typename ComparableToKey > |
bool | contains (const ComparableToKey &key, Value *&outValue) |
| Check if the given key is contained in the map. More...
|
|
template<typename ComparableToKey > |
const Value * | get (const ComparableToKey &key) const |
| Get the Value associated to the given key. More...
|
|
template<typename ComparableToKey > |
Value * | get (const ComparableToKey &key) |
| Get the Value associated to the given key. More...
|
|
template<typename ComparableToKey > |
Value * | getOrCreate (const ComparableToKey &key) |
| Get the value associated to the given key, or creates a new one if needed. More...
|
|
template<typename Key, typename Value, typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
struct SC::VectorMap< Key, Value, Container >
A map holding VectorMapItem key-value pairs in an unsorted Vector.
- Template Parameters
-
Key | Type of the key (must support == comparison) |
Value | Value type associated with Key |
Container | Container used for the Map |
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
bool SC::VectorMap< Key, Value, Container >::contains |
( |
const ComparableToKey & |
key, |
|
|
const Value *& |
outValue |
|
) |
| const |
|
inline |
Check if the given key is contained in the map.
- Parameters
-
key | The key to search for inside current map |
outValue | A reference that will receive pointer to the found element (if found) |
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
bool SC::VectorMap< Key, Value, Container >::contains |
( |
const ComparableToKey & |
key, |
|
|
Value *& |
outValue |
|
) |
| |
|
inline |
Check if the given key is contained in the map.
- Parameters
-
key | The key to search for inside current map |
outValue | A reference that will receive pointer to the found element (if found) |
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
Value * SC::VectorMap< Key, Value, Container >::get |
( |
const ComparableToKey & |
key | ) |
|
|
inline |
Get the Value associated to the given key.
- Returns
- A pointer to the value if it exists in the map,
nullptr
otherwise
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
const Value * SC::VectorMap< Key, Value, Container >::get |
( |
const ComparableToKey & |
key | ) |
const |
|
inline |
Get the Value associated to the given key.
- Returns
- A pointer to the value if it exists in the map,
nullptr
otherwise
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
Value * SC::VectorMap< Key, Value, Container >::getOrCreate |
( |
const ComparableToKey & |
key | ) |
|
|
inline |
Get the value associated to the given key, or creates a new one if needed.
- Returns
- A pointer to the value or
nullptr
if the map is full
template<typename Key , typename Value , typename Container = SC::Vector<SC::VectorMapItem<Key, Value>>>
template<typename ComparableToKey >
bool SC::VectorMap< Key, Value, Container >::remove |
( |
const ComparableToKey & |
key | ) |
|
|
inline |
Remove an item with matching key from the Map.
- Parameters
-
key | The key that must be removed |
- Returns
true
if the item was found