jubilant-funicular
|
#include <TypeMap.h>
Public Types | |
using | iterator = std::unordered_map< TypeInfo, void * >::iterator |
using | const_iterator = std::unordered_map< TypeInfo, void * >::const_iterator |
Public Member Functions | |
template<typename T > | |
bool | contains () const |
template<typename T > | |
void | insert (T data) |
template<typename T > | |
std::add_lvalue_reference< T >::type | find () const |
void * | find (const TypeInfo &info) const |
template<typename T > | |
std::add_lvalue_reference< T >::type | get () |
template<typename T > | |
void | erase () |
void | erase (const TypeInfo &info) |
bool | empty () const |
bool | is_empty () const |
std::size_t | size () const |
void | clear () |
iterator | begin () |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | cend () const |
Private Member Functions | |
void | destroy (const TypeInfo &info) |
Private Attributes | |
std::unordered_map< TypeInfo, void * > | m_map |
A map from types to values of the given type
Note: Only one value of a given type may be stored
std::add_lvalue_reference< T >::type utils::TypeMap::find |
find is the same as get except a element of type T must already exist in the TypeMap. If not, it will crash.
Definition at line 133 of file TypeMap.h.
Referenced by nta::ECS::add_component(), nta::ECS::get_component(), nta::ECS::get_component_list(), and nta::ECS::has_component().
void * utils::TypeMap::find | ( | const TypeInfo & | info | ) | const |
This version of find returns a nullptr if the key does not already exist
Properly using this function requires some knowledge of how TypeMap works internally
Definition at line 4 of file TypeMap.cpp.
std::add_lvalue_reference< T >::type utils::TypeMap::get |