#include <core/memory/type_map.hpp>
template<typename V>
TypeMap class
A map that stores values of type V
, using reflection types as keys.
Template parameters | |
---|---|
V | Values type. |
Public functions
-
void insert(const reflection::
Type& type, V value) - Sets the value associated to the given type.
-
template<typename K>void insert(V value)
- Sets the value associated to the given type.
-
auto erase(const reflection::
Type& type) -> bool - Removes the entry associated to the given type.
-
template<typename K>auto erase() -> bool
- Removes the entry associated to the given type.
-
auto contains(const reflection::
Type& type) const -> bool - Checks if there's a an entry with the given type.
-
template<typename K>auto contains() const -> bool
- Checks if there's a an entry with the given type.
-
auto at(const reflection::
Type& type) -> V& - Gets the value associated to the given type.
-
template<typename K>auto at() -> V&
- Gets the value associated to the given type.
-
auto at(const reflection::
Type& type) const -> const V& - Gets the value associated to the given type.
-
template<typename K>auto at() const -> const V&
- Gets the value associated to the given type.
- void clear()
- Removes all entries from the map.
- auto size() const -> std::size_t
- Gets the number of entries in the map.
- auto empty() const -> bool
- Checks if the map is empty.
- auto begin() -> auto
- Gets an iterator to the beginning of the map.
- auto end() -> auto
- Gets an iterator to the end of the map.
- auto begin() const -> auto
- Gets an iterator to the beginning of the map.
- auto end() const -> auto
- Gets an iterator to the end of the map.
Function documentation
template<typename V>
void cubos:: core:: memory:: TypeMap<V>:: insert(const reflection:: Type& type,
V value)
Sets the value associated to the given type.
Parameters | |
---|---|
type | Type. |
value | Value. |
template<typename V>
template<typename K>
void cubos:: core:: memory:: TypeMap<V>:: insert(V value)
Sets the value associated to the given type.
Template parameters | |
---|---|
K | Type. |
Parameters | |
value | Value. |
template<typename V>
bool cubos:: core:: memory:: TypeMap<V>:: erase(const reflection:: Type& type)
Removes the entry associated to the given type.
Parameters | |
---|---|
type | Type. |
Returns | Whether the entry was removed. |
template<typename V>
template<typename K>
bool cubos:: core:: memory:: TypeMap<V>:: erase()
Removes the entry associated to the given type.
Template parameters | |
---|---|
K | Type. |
Returns | Whether the entry was removed. |
template<typename V>
bool cubos:: core:: memory:: TypeMap<V>:: contains(const reflection:: Type& type) const
Checks if there's a an entry with the given type.
Parameters | |
---|---|
type | Type. |
Returns | Whether there's an entry with the given type. |
template<typename V>
template<typename K>
bool cubos:: core:: memory:: TypeMap<V>:: contains() const
Checks if there's a an entry with the given type.
Template parameters | |
---|---|
K | Type. |
Returns | Whether there's an entry with the given type. |
template<typename V>
V& cubos:: core:: memory:: TypeMap<V>:: at(const reflection:: Type& type)
Gets the value associated to the given type.
Parameters | |
---|---|
type | Type. |
Returns | Reference to the value. |
template<typename V>
template<typename K>
V& cubos:: core:: memory:: TypeMap<V>:: at()
Gets the value associated to the given type.
Template parameters | |
---|---|
K | Type. |
Returns | Reference to the value. |
template<typename V>
const V& cubos:: core:: memory:: TypeMap<V>:: at(const reflection:: Type& type) const
Gets the value associated to the given type.
Parameters | |
---|---|
type | Type. |
Returns | Reference to the value. |
template<typename V>
template<typename K>
const V& cubos:: core:: memory:: TypeMap<V>:: at() const
Gets the value associated to the given type.
Template parameters | |
---|---|
K | Type. |
Returns | Reference to the value. |
template<typename V>
std::size_t cubos:: core:: memory:: TypeMap<V>:: size() const
Gets the number of entries in the map.
Returns | Values count. |
---|
template<typename V>
bool cubos:: core:: memory:: TypeMap<V>:: empty() const
Checks if the map is empty.
Returns | Whether the map is empty. |
---|
template<typename V>
auto cubos:: core:: memory:: TypeMap<V>:: begin()
Gets an iterator to the beginning of the map.
Returns | Iterator. |
---|
template<typename V>
auto cubos:: core:: memory:: TypeMap<V>:: end()
Gets an iterator to the end of the map.
Returns | Iterator. |
---|
template<typename V>
auto cubos:: core:: memory:: TypeMap<V>:: begin() const
Gets an iterator to the beginning of the map.
Returns | Iterator. |
---|
template<typename V>
auto cubos:: core:: memory:: TypeMap<V>:: end() const
Gets an iterator to the end of the map.
Returns | Iterator. |
---|