Karma Engine
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

ValueType & FindOrAdd (const KeyType &Key)
 
ValueType * Find (const KeyType &Key)
 

Protected Attributes

AMap m_KeyValuePair
 

Detailed Description

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

Karma's std::map wrapper.

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.

◆ 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.

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