|
| Map ()=default |
| Standard constructor. More...
|
|
| Map (const map_type &other) |
| Constructor from a standard map. More...
|
|
template<typename In > |
| Map (In &&first, In &&last) |
| Construct from a subset. More...
|
|
virtual | ~Map ()=default |
| Virtual destructor. You can inherit from this map type. More...
|
|
iterator | begin () |
|
iterator | end () |
|
const_iterator | begin () const |
|
const_iterator | end () const |
|
mapped_type & | operator[] (const key_type &key) |
|
iterator | find (const key_type &key) |
|
const_iterator | find (const key_type &key) const |
|
size_type | count (const key_type &key) const |
|
iterator | lower_bound (const key_type &key) |
|
const_iterator | lower_bound (const key_type &key) const |
|
iterator | upper_bound (const key_type &key) |
|
const_iterator | upper_bound (const key_type &key) const |
|
std::pair< iterator, iterator > | equal_range (const key_type &key) |
|
std::pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
|
template<class... Args> |
std::pair< iterator, bool > | emplace (Args &&...args) |
|
template<typename ValueType > |
std::pair< iterator, bool > | insert (ValueType &&val) |
|
std::pair< iterator, bool > | insert (value_type &&val) |
|
template<typename In > |
void | insert (In &&first, In &&last) |
|
template<typename ValueType > |
iterator | insert (iterator, ValueType &&val) |
|
iterator | erase (const_iterator pos) |
|
size_type | erase (const key_type &key) |
|
iterator | erase (const_iterator first, const_iterator last) |
|
void | clear () |
|
size_type | size () const |
|
size_type | max_size () const |
|
bool | empty () const |
|
void | swap (map_type &other) |
|
const result_type & | operator() (const argument_type &key) const |
| Allow to use Map as an unary function. More...
|
|
const mapped_type & | operator[] (const key_type &key) const |
| Access elements of a const Map. More...
|
|
const result_type & | at (const argument_type &key) const |
| checked access to the map - Exceptions
-
More...
|
|
Map & | merge (const map_type &other) |
| Merge two maps. More...
|
|
Map & | merge (const Map &other) |
| Merge two maps. More...
|
|
template<class K1 , class K2 , class K3 > |
Map & | merge (const Map< K1, K2, K3 > &other) |
| Merge two maps. More...
|
|
void | update (const key_type &key, const mapped_type &mapped) |
|
| operator map_type & () |
| Allows to use the Map wherever an std::map is explicitly requested. More...
|
|
| operator const map_type & () const |
|
const key_type & | key_at (const size_type index) const |
| useful method for python decoration: More...
|
|
const mapped_type & | value_at (const size_type index) const |
| useful method for python decoration: More...
|
|
virtual | ~MapBase () |
| virtual destructor More...
|
|
template<typename K, typename T, typename M = std::map<K, T>>
class GaudiUtils::Map< K, T, M >
Extension of the STL map.
Provides const accessors and can be extended by inheritance.
- See also
- std::map Note: in order to make it possible to use either a map or a hash_map, reverse iterators are not defined.
Due to helper base class Gaudi::Utils::MapBase, this class is "python-friendly", and one can perform all python manipulaitons in intuitive way:
>>>
m = ... ##
get the
map>>> print
m ## print the
map a
'la python class dict...
>>> for key in m : print key, m[key] ## iteration over the map
...
>>> for key,value in m.iteritems() : print key, value
...
>>> keys = m.keys() ## get the list of keys
>>> values = m.values () ## get the list of values
>> items = m.items () ## get the list of items
>>> if 'one' in m ## check the presence of the key in map
>>> v = m.get(key', None) ##
return m[key]
for existing key,
else None
>>> value
m[key] ## unchecked access through the key
...
- Attention
- The syntax can be drastically simplified, if one redefines the setitem attribute:
>>>
m[key] = value ## much more intuitive semantics
for key insertion
In a similar way __getitem__
and __delitem__
methods can be redefined.
- Attention
- To avoid the unnesessary expansion of dictionaries it is recommended to exclude from dictionary the following methods:
- lower_bound
- upper_bound
- equal_range
- insert
- Warning
- This action is required for
HashMap
to avodi the compilation problems
- See also
- Gaudi::Utils::MapBase
- Author
- Marco Clemencic
- Date
- 2005-10-06
Definition at line 82 of file Map.h.