KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
KarmaMap< KeyType, ValueType > Class Template Reference

Karma's std::map wrapper. More...

#include <KarmaTypes.h>

Public Types

typedef std::map< KeyType, ValueType > AMap
 
typedef AMap::iterator AnIterator
 

Public Member Functions

 KarmaMap ()
 Constructor.
 
ValueType & FindOrAdd (const KeyType &Key)
 Find the value associated with a specified key, or if none exists, adds a value using the default constructor.
 
ValueType * Find (const KeyType &Key)
 Find the value associated with a specified key.
 

Protected Attributes

AMap m_KeyValuePair
 

Detailed Description

template<typename KeyType, typename ValueType>
class KarmaMap< KeyType, ValueType >

Karma's std::map wrapper.

Constructor & Destructor Documentation

◆ KarmaMap()

template<typename KeyType, typename ValueType>
KarmaMap< KeyType, ValueType >::KarmaMap ( )
inline

Constructor.

Since
Karma 1.0.0

Member Function Documentation

◆ Find()

template<typename KeyType, typename ValueType>
ValueType * KarmaMap< KeyType, ValueType >::Find ( const KeyType & Key)
inline

Find the value associated with a specified key.

Parameters
KeyThe key to search for.
Returns
A pointer to the value associated with the specified key, or nullptr if the key isn't contained in this map. The pointer is only valid until the next change to any key in the map.
Since
Karma 1.0.0

◆ FindOrAdd()

template<typename KeyType, typename ValueType>
ValueType & KarmaMap< KeyType, ValueType >::FindOrAdd ( const KeyType & Key)
inline

Find the value associated with a specified key, or if none exists, adds a value using the default constructor.

Algorithm courtsey: https://stackoverflow.com/a/1409465

Parameters
KeyThe key to search for.
Returns
A reference to the value associated with the specified key
Since
Karma 1.0.0

The documentation for this class was generated from the following file: