#include <VectorMap.h>
Public Types | |
typedef KEY | key_type |
the actual type of key | |
typedef VALUE | mapped_type |
the actual type of value | |
typedef KEYCOMPARE | key_compare |
comparison of keys | |
typedef std::pair< key_type, mapped_type > | value_type |
the actual storage item | |
typedef ALLOCATOR | allocator_type |
allocator (could be useful for optimizations) | |
typedef ALLOCATOR::const_reference | reference |
the types to conform STL | |
typedef ALLOCATOR::const_reference | const_reference |
the types to conform STL | |
typedef ALLOCATOR::size_type | size_type |
the types to conform STL | |
typedef ALLOCATOR::difference_type | difference_type |
the types to conform STL | |
typedef std::vector< value_type, allocator_type > | _vector |
the actual storage container (no export) | |
typedef _vector::const_iterator | iterator |
visible const_iterator (exported) | |
typedef _vector::const_iterator | const_iterator |
visible const_iterator (exported) | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
visible reverse const_iterator (exported) | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
visible reverse const_iterator (exported) | |
typedef std::pair< iterator, iterator > | iterators |
visible iterator pait | |
typedef std::pair< iterator, bool > | result_type |
visible iterator pait | |
typedef _compare_type | compare_type |
the actual comparison criteria for valye_type objects | |
Public Member Functions | |
iterator | begin () const |
"begin" iterator for sequential access (const-only version!) | |
iterator | end () const |
"end" iterator for sequential access (const-only version!) | |
reverse_iterator | rbegin () const |
"rbegin" iterator for sequential access (const-only version!) | |
reverse_iterator | rend () const |
"rend" iterator for sequential access (const-only version!) | |
void | erase (iterator pos) |
erase the element using the iterator | |
size_type | erase (const key_type &key) |
erase the element using the key | |
size_type | erase (iterator first, iterator last) |
erase the sequence of elements using the iterators | |
template<class TYPE> | |
size_type | erase (TYPE first, TYPE last) |
erase the sequence of elements using the sequence of keys | |
result_type | insert (const key_type &key, const mapped_type &mapped) |
insert the (key,value) pair into the container | |
result_type | insert (const value_type &value) |
insert the (key,value) pair into the container | |
result_type | insert (iterator pos, const value_type &value) |
insert the element with some guess about its new position With the right guess the method could be more efficient | |
result_type | insert (iterator pos, const key_type &key, const mapped_type &mapped) |
insert the (key,value) pair into the container With the right guess the method could be more efficient | |
template<class PAIRS> | |
void | insert (PAIRS first, PAIRS last) |
insert the sequence of elements into the container | |
template<class KEYS, class VALUES> | |
void | insert (KEYS kf, KEYS kl, VALUES vf) |
insert into the container the elements from 2 "parallel" sequences | |
iterator | find (const key_type &key) const |
find the element by key | |
size_type | count (const key_type &key) const |
count number of elements with the certain key | |
iterator | lower_bound (const key_type &key) const |
iterator | upper_bound (const key_type &key) const |
iterators | equal_range (const key_type &key) const |
bool | empty () const |
empty container ? | |
size_type | size () const |
number of elements | |
size_type | max_size () const |
maximal allowed size | |
void | clear () |
clear the container | |
void | reserve (size_type num) |
reserve the space in the container for at least 'num' elements | |
void | swap (VectorMap &other) |
swap function, which 'swaps' the content of two containers | |
bool | operator== (const VectorMap &other) const |
comparison criteria for containers | |
bool | operator< (const VectorMap &other) const |
comparison criteria for containers | |
iterator | update (const key_type &key, const mapped_type &mapped) |
forced insertion of the key/mapped pair The method acts like "insert" but it *DOES* overwrite the existing mapped value. | |
iterator | update (const value_type &val) |
forced insertion of the key/mapped pair The method acts like "insert" but it *DOES* overwrite the mapped value. | |
const mapped_type & | operator() (const key_type &key) const |
access to element by key (const version) there is no container increment for missing keys | |
const mapped_type & | operator[] (const key_type &key) const |
access to element by key (const version) there is no container increment for missing keys | |
const mapped_type & | at (const key_type &key) const |
checked access to elements by key throw std::out_of_range exception for non-existing keys | |
VectorMap (const allocator_type &alloc=allocator_type()) | |
default constructor from the the allocator | |
VectorMap (const VectorMap &right) | |
copy constructor | |
template<class INPUT> | |
VectorMap (INPUT first, INPUT last, const allocator_type &alloc=allocator_type()) | |
templated constructor from "convertible" sequence | |
~VectorMap () | |
destructor (non-virtual!) | |
VectorMap & | operator= (const VectorMap &right) |
const compare_type & | compare () const |
get the comparison criteria itself | |
const key_compare & | compare_key () const |
get the comparison criteria for keys | |
Protected Types | |
typedef _vector::iterator | _iterator |
the regular iterator (no export) | |
Protected Member Functions | |
template<class TYPE1, class TYPE2> | |
bool | compare (const TYPE1 &obj1, const TYPE2 &obj2) const |
compare the objects using the comaprison criteria | |
_iterator | lower_bound (const key_type &key) |
'lower-bound' - non-const version | |
_iterator | iter (iterator p) |
the conversion from 'const' to 'non-const' iterator | |
iterator | iter (_iterator p) |
the conversion from 'non-const' to 'const' iterator | |
Private Attributes | |
_vector | m_vct |
the underlying sorted vector of (key,mapped) pairs | |
Friends | |
bool | operator> (const VectorMap &left, const VectorMap &right) |
bool | operator!= (const VectorMap &left, const VectorMap &right) |
bool | operator>= (const VectorMap &left, const VectorMap &right) |
bool | operator<= (const VectorMap &left, const VectorMap &right) |
std::ostream & | operator<< (std::ostream &str, const VectorMap &) |
printout to ostream - not implemented | |
Classes | |
struct | _compare_type |
The actual structure used to compare the elements Only "key" is important for comparison. More... |
The number of "non-const" operations is reduced, e.g. all non-const iterators are not exported, therefore it is almost impossible e.g. externally re-sort the underlying sorted container.
--------------------------- The nominal CPU performance: --------------------------- Container insertion: O(N) Container look-up: O(log(N)) (a'la std::map, but a bit faster)
It could be used as a "light" and good alternative for std::map associative container, in the case of relatively rare insertion and frequent look-up.
Definition at line 55 of file VectorMap.h.
typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type |
typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type |
typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare |
typedef std::pair<key_type,mapped_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::value_type |
typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type |
typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference |
typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reference |
typedef ALLOCATOR::size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type |
typedef ALLOCATOR::difference_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type |
typedef std::vector<value_type,allocator_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::_vector |
typedef _vector::iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::_iterator [protected] |
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator |
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator |
typedef std::reverse_iterator<iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reverse_iterator |
typedef std::reverse_iterator<const_iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reverse_iterator |
typedef std::pair<iterator,iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators |
typedef std::pair<iterator,bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type |
typedef _compare_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_type |
GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | const allocator_type & | alloc = allocator_type () |
) | [inline] |
default constructor from the the allocator
cmp | comparison criteria for the key | |
alloc | allocator to be used |
Definition at line 658 of file VectorMap.h.
00659 : m_vct ( alloc ) 00660 {}
GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right | ) | [inline] |
copy constructor
right | object to be copied |
Definition at line 665 of file VectorMap.h.
00666 : m_vct ( right.m_vct ) 00667 {}
GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | INPUT | first, | |
INPUT | last, | |||
const allocator_type & | alloc = allocator_type () | |||
) | [inline] |
templated constructor from "convertible" sequence
first | 'begin'-iterator for the convertible sequence | |
last | 'end'-iterator for the convertible sequence | |
cmp | comparison criteria for the key | |
alloc | allocator to be used |
Definition at line 676 of file VectorMap.h.
00679 : m_vct ( first , last , alloc ) 00680 { std::sort ( m_vct.begin(), m_vct.end(), compare() ) ; }
GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::~VectorMap | ( | ) | [inline] |
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin | ( | ) | const [inline] |
"begin" iterator for sequential access (const-only version!)
Definition at line 130 of file VectorMap.h.
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end | ( | ) | const [inline] |
"end" iterator for sequential access (const-only version!)
Definition at line 132 of file VectorMap.h.
reverse_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::rbegin | ( | ) | const [inline] |
"rbegin" iterator for sequential access (const-only version!)
Definition at line 134 of file VectorMap.h.
reverse_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::rend | ( | ) | const [inline] |
"rend" iterator for sequential access (const-only version!)
Definition at line 136 of file VectorMap.h.
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | iterator | pos | ) | [inline] |
erase the element using the iterator
pos | position of the element to be erased |
Definition at line 145 of file VectorMap.h.
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | const key_type & | key | ) | [inline] |
erase the element using the key
GaudiUtils::VectorMap<K,V> m = ... ; ... K key = ... ; std::cout << " # of erased elements " << m.erase ( key ) << std::endl ;
key | key for the element to be erased |
Definition at line 163 of file VectorMap.h.
00164 { 00165 iterator pos = find ( key ) ; 00166 if ( end() == pos ) { return 0 ; } 00167 erase ( pos ) ; 00168 return 1 ; 00169 } ;
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | iterator | first, | |
iterator | last | |||
) | [inline] |
erase the sequence of elements using the iterators
first | begin iterator of sub-sequence to be erased | |
end | end iterator of the sub_sequence to be erased |
Definition at line 176 of file VectorMap.h.
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | TYPE | first, | |
TYPE | last | |||
) | [inline] |
erase the sequence of elements using the sequence of keys
GaudiUtils::VectorMap<K,V> m = ... ; // some sequence of keys, to be removed KEYS keys = ... ; std::cout << " # keys to be removed: " << keys.size() << " # keys removed: " << m.erase( keys.begin() , keys.end() ) << std::endl ;
first | begin-iterator for the sequence of keys | |
last | end-iterator for the sequence of keys |
Definition at line 204 of file VectorMap.h.
00205 { 00206 size_type res = 0 ; 00207 for ( ; first != last ; ++first ) { res += erase ( *first ) ; } 00208 return res ; 00209 }
result_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | const key_type & | key, | |
const mapped_type & | mapped | |||
) | [inline] |
insert the (key,value) pair into the container
GaudiUtils::VectorMap<K,V> m ; K key = ... ; V val1 = ... ; V val2 = ... ; std::cout << " Before insert: " << m[key] // should be: V() << std::end ; // insert the value into the map: const bool inserted1 = m.insert( key , val1 ).second ; std::cout << " 1st insert: " << Gaudi::Utils::toString( inserted1 ) // should be: "True" << " value: " << m[key] // should be: val1 << std::endl ; // try to re-insert another value with the same key: const bool inserted2 = m.insert( key , val2 ).second ; std::cout << " 2nd insert: " << Gaudi::Utils::toString( inserted2 ) // should be: "False" << " value: " << m[key] // should be: val1 << std::endl ;
key | key value to be inserted | |
mapped | value to be associated with the key |
Definition at line 253 of file VectorMap.h.
00255 { return insert ( value_type ( key , mapped ) ) ; }
result_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | const value_type & | value | ) | [inline] |
insert the (key,value) pair into the container
GaudiUtils::VectorMap<K,V> m ; K key = ... ; V val1 = ... ; V val2 = ... ; std::cout << " Before insert: " << m[key] // should be: V() << std::end ; // insert the value into the map: const bool inserted1 = m.insert ( std::make_pair( key , val1 ) ).second ; std::cout << " 1st insert: " << Gaudi::Utils::toString( inserted1 ) // should be: "True" << " value: " << m[key] // should be: val1 << std::endl ; // try to re-insert another value with the same key: const bool inserted2 = m.insert ( std::make_pair( key , val2 ) ).second ; std::cout << " 2nd insert: " << Gaudi::Utils::toString( inserted2 ) // should be: "False" << " value: " << m[key] // should be: val1 << std::endl ;
value | value to be inserted |
Definition at line 298 of file VectorMap.h.
00299 { 00300 bool found = true ; 00301 _iterator result = lower_bound ( value.first ) ; 00302 if ( end() == result || compare( value.first , result -> first ) ) 00303 { result = m_vct.insert ( result , value ) ; found = false ; } 00304 return result_type ( iter ( result ) , !found ) ; 00305 }
result_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | iterator | pos, | |
const value_type & | value | |||
) | [inline] |
insert the element with some guess about its new position With the right guess the method could be more efficient
pos | the guess about position where to insert the element | |
value | value to be inserted |
Definition at line 316 of file VectorMap.h.
00318 { 00319 if ( pos != end() && compare ( *pos , value ) && 00320 ( pos == end() - 1 || 00321 ( !compare ( value , *( pos + 1 ) ) 00322 && compare ( *( pos + 1 ) , value ) ) ) ) 00323 { return result_type( m_vct.insert ( iter ( pos ) , value ) , true ) ; } 00324 return insert ( value ) ; 00325 }
result_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | iterator | pos, | |
const key_type & | key, | |||
const mapped_type & | mapped | |||
) | [inline] |
insert the (key,value) pair into the container With the right guess the method could be more efficient
pos | the guess about position where to insert the element | |
key | key value to be inserted | |
mapped | value to be associated with the key |
Definition at line 337 of file VectorMap.h.
00340 { return insert ( pos , value_type ( key , mapped ) ) ; }
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | PAIRS | first, | |
PAIRS | last | |||
) | [inline] |
insert the sequence of elements into the container
first | the begin iterator of the sequence | |
last | the end iterator of the sequence |
Definition at line 349 of file VectorMap.h.
00351 { for ( ; first != last ; ++first ) { insert ( *first ) ; } }
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | KEYS | kf, | |
KEYS | kl, | |||
VALUES | vf | |||
) | [inline] |
insert into the container the elements from 2 "parallel" sequences
kf | the begin iterator of the sequence of keys | |
kl | the end iterator of the sequence of keys | |
vf | the begin iterator of the sequence of values |
Definition at line 360 of file VectorMap.h.
00363 { for ( ; kf != kl ; ++kf, ++vf ) { insert ( *kf , *vf ) ; } }
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find | ( | const key_type & | key | ) | const [inline] |
find the element by key
typedef GaudiUtils::VectorMap<K,V> Map ; Map m = ... ; K key = ...; // Is key in the container? Map::iterator ifound = m.find( key ) ; if ( m.end() != ifound ) { std::cout << "The value is : " << ifound->second << std::endl ; }
key | key to be searched |
Definition at line 392 of file VectorMap.h.
00393 { 00394 iterator res = lower_bound ( key ) ; 00395 if ( end() != res && compare ( key , res->first ) ) 00396 { res = end(); } 00397 return res ; 00398 }
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::count | ( | const key_type & | key | ) | const [inline] |
count number of elements with the certain key
GaudiUtils::VectorMap<K,V> m = ... ; K key = ... ; std::cout << " # of elements for the key: " << m.count(key) << std::end ;
key | key to be searched |
Definition at line 415 of file VectorMap.h.
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound | ( | const key_type & | key | ) | const [inline] |
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::upper_bound | ( | const key_type & | key | ) | const [inline] |
iterators GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::equal_range | ( | const key_type & | key | ) | const [inline] |
bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::empty | ( | ) | const [inline] |
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size | ( | ) | const [inline] |
size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::max_size | ( | ) | const [inline] |
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::clear | ( | ) | [inline] |
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reserve | ( | size_type | num | ) | [inline] |
reserve the space in the container for at least 'num' elements
Definition at line 439 of file VectorMap.h.
00439 { m_vct.reserve ( num ) ; }
void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::swap | ( | VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | other | ) | [inline] |
swap function, which 'swaps' the content of two containers
Definition at line 442 of file VectorMap.h.
bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator== | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | other | ) | const [inline] |
comparison criteria for containers
Definition at line 452 of file VectorMap.h.
00453 { return m_vct == other.m_vct ; }
bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator< | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | other | ) | const [inline] |
comparison criteria for containers
Definition at line 456 of file VectorMap.h.
00457 { return m_vct < other.m_vct ; }
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update | ( | const key_type & | key, | |
const mapped_type & | mapped | |||
) | [inline] |
forced insertion of the key/mapped pair The method acts like "insert" but it *DOES* overwrite the existing mapped value.
GaudiUtils::VectorMap<K,V> m = ... ; K key = ... ; V val1 = ... ; V val2 = ... ; std::cout << "Value " << m[key] << std::endl ; // should be: V() m.update ( key , val1 ) ; std::cout << "Value " << m[key] << std::endl ; // should be: val1 m.update ( key , val2 ) ; std::cout << "Value " << m[key] << std::endl ; // should be: val2
key | key value | |
mapped | mapped value |
Definition at line 510 of file VectorMap.h.
00512 { 00513 _iterator result = lower_bound ( key ) ; 00514 if ( end() == result || compare ( key , result -> first ) ) 00515 { result = m_vct.insert ( result , value_type(key,mapped) ) ; } 00516 else 00517 { result->second = mapped ; } 00518 return iter ( result ) ; 00519 }
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update | ( | const value_type & | val | ) | [inline] |
forced insertion of the key/mapped pair The method acts like "insert" but it *DOES* overwrite the mapped value.
GaudiUtils::VectorMap<K,V> m = ... ; K key = ... ; V val1 = ... ; V val2 = ... ; std::cout << "Value " << m[key] << std::endl ; // should be: V() m.update ( std::make_pair ( key , val1 ) ) ; std::cout << "Value " << m[key] << std::endl ; // should be: val1 m.update ( std::make_pair ( key , val2 ) ) ; std::cout << "Value " << m[key] << std::endl ; // should be: val2
val | a pair of (key,value) |
Definition at line 549 of file VectorMap.h.
00550 { return update ( val.first , val.second ) ; }
const mapped_type& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator() | ( | const key_type & | key | ) | const [inline] |
access to element by key (const version) there is no container increment for missing keys
GaudiUtils::VectorMap<K,V> m = ... ; // OK: K key = ... ; std::cout << " Value: " << m(key) << std::end ; // it is OK! // ERROR: V value = ... ; m(key) = value ; // ERROR!
key | key value |
Definition at line 583 of file VectorMap.h.
00584 { 00585 static const mapped_type s_default = mapped_type() ; 00586 iterator res = find ( key ) ; 00587 if ( end() == res ) { return s_default ; } 00588 return res->second ; 00589 }
const mapped_type& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator[] | ( | const key_type & | key | ) | const [inline] |
access to element by key (const version) there is no container increment for missing keys
GaudiUtils::VectorMap<K,V> m = ... ; // OK: K key = ... ; std::cout << " Value: " << m[key] << std::end ; // it is OK! // ERROR: V value = ... ; m[key] = value ; // ERROR!
key | key value |
Definition at line 620 of file VectorMap.h.
const mapped_type& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::at | ( | const key_type & | key | ) | const [inline] |
checked access to elements by key throw std::out_of_range exception for non-existing keys
GaudiUtils::VectorMap<K,V> m = ... ; // OK: K key = ... ; std::cout << " Value: " << m.at(key) << std::end ; // it is OK!
std::out_of_range | for non-existing keys |
key | key value |
Definition at line 640 of file VectorMap.h.
00641 { 00642 iterator res = find ( key ) ; 00643 if ( end() == res ) 00644 { GaudiUtils::_throw_out_of_range_exception_() ; } 00645 return res->second ; 00646 }
VectorMap& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator= | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right | ) | [inline] |
Definition at line 689 of file VectorMap.h.
00690 { 00691 if ( &right == this ) { return *this ; } 00692 m_vct = right.m_vct ; 00693 return *this ; 00694 }
const compare_type& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare | ( | ) | const [inline] |
get the comparison criteria itself
Definition at line 703 of file VectorMap.h.
00704 { 00705 static const compare_type s_cmp = compare_type() ; 00706 return s_cmp ; 00707 }
const key_compare& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_key | ( | ) | const [inline] |
get the comparison criteria for keys
Definition at line 709 of file VectorMap.h.
00709 { return compare() ; }
bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare | ( | const TYPE1 & | obj1, | |
const TYPE2 & | obj2 | |||
) | const [inline, protected] |
compare the objects using the comaprison criteria
obj | the first object | |
obj | the second object |
Definition at line 727 of file VectorMap.h.
00729 { 00730 return compare() ( obj1 , obj2 ) ; 00731 }
_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound | ( | const key_type & | key | ) | [inline, protected] |
'lower-bound' - non-const version
Definition at line 734 of file VectorMap.h.
00735 { 00736 return std::lower_bound 00737 ( m_vct.begin() , m_vct.end() , key , compare() ) ; 00738 } ;
_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter | ( | iterator | p | ) | [inline, protected] |
iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter | ( | _iterator | p | ) | [inline, protected] |
std::ostream& operator<< | ( | std::ostream & | str, | |
const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | ||||
) | [friend] |
_vector GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct [private] |