| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > Class Template Reference

`#include <VectorMap.h>`

Collaboration diagram for GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >:

[legend]
List of all members.

## Detailed Description

### template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
class GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >

A bit modified version of 'LokiAssocVector' associative vector from Loki library by Andrei Alexandrescu.

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 performace: --------------------------- 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.

Author:
  Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr

Date:
  2005-07-23

Definition at line 55 of file 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
| comparion 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 comparion 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 moure 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 exising 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 contructor 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 &)
| printtut to ostream - not implemented
## Classes
struct | _compare_type
| The actual structure used to compare the elemenents Only "key" is important for comparison. More...

## Member Typedef Documentation

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type

the actual type of key

Definition at line 59 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type

the actual type of value

Definition at line 61 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare

comparion of keys

Definition at line 63 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::pair<key_type,mapped_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::value_type

the actual storage item

Definition at line 65 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type

allocator (could be useful for optimizations)

Definition at line 68 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference

the types to conform STL

Definition at line 70 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reference

the types to conform STL

Definition at line 72 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef ALLOCATOR::size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type

the types to conform STL

Definition at line 74 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef ALLOCATOR::difference_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type

the types to conform STL

Definition at line 76 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::vector<value_type,allocator_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::_vector

the actual storage container (no export)

Definition at line 79 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef _vector::iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::_iterator`[protected]`

the regular iterator (no export)

Definition at line 82 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator

visible const_iterator (exported)

Definition at line 85 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator

visible const_iterator (exported)

Definition at line 87 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::reverse_iterator<iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reverse_iterator

visible reverse const_iterator (exported)

Definition at line 89 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::reverse_iterator<const_iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reverse_iterator

visible reverse const_iterator (exported)

Definition at line 91 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::pair<iterator,iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators

visible iterator pait

Definition at line 93 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef std::pair<iterator,bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type

visible iterator pait

Definition at line 95 of file VectorMap.h.

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

typedef _compare_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_type

the actual comparion criteria for valye_type objects

Definition at line 122 of file VectorMap.h.

## Constructor & Destructor Documentation

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | const allocator_type & | alloc = `allocator_type ()` | ) | `[inline]`

default constructor from the the allocator

Parameters:

  | cmp | comparision criteria for the key
  | alloc | allocator to be used

Definition at line 657 of file VectorMap.h.

    00658       : m_vct ( alloc )
    00659     {} ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right | ) | `[inline]`

copy constructor

Parameters:

  | right | object to be copied

Definition at line 664 of file VectorMap.h.

    00665       : m_vct ( right.m_vct )
    00666     {}

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
template<class INPUT>

GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap | ( | INPUT | first,
|  | INPUT | last,
|  | const allocator_type & | alloc = `allocator_type ()` |
| ) |  |  | `[inline]`

templated contructor from "convertible" sequence

Parameters:

  | first | 'begin'-iterator for the convertible sequence
  | last | 'end'-iterator for the convertible sequence
  | cmp | comparision criteria for the key
  | alloc | allocator to be used

Definition at line 675 of file VectorMap.h.

References std::vector< _Tp, _Alloc >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), std::vector< _Tp, _Alloc >::end(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct, and std::sort().

    00678       : m_vct ( first , last , alloc )
    00679     { std::sort ( m_vct.begin(), m_vct.end(), compare() ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::~VectorMap | ( |  | ) | `[inline]`

destructor (non-virtual!)

Definition at line 682 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::clear().

    00682 { clear() ; }

## Member Function Documentation

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::equal_range(), Tuples::TupleObj::fmatrix(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), Gaudi::Utils::toStream(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::upper_bound().

    00130 { return m_vct . begin  () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::at(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::count(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::equal_range(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find(), Tuples::TupleObj::fmatrix(), TimingAuditor::i_afterExecute(), TimingAuditor::i_beforeExecute(), TimingAuditor::i_beforeInitialize(), TimingAuditor::initialize(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator()(), Gaudi::Utils::toStream(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::upper_bound().

    00132 { return m_vct . end    () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00134 { return m_vct . rbegin () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00136 { return m_vct . rend   () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | iterator | pos | ) | `[inline]`

erase the element using the iterator

Parameters:

  | pos | position of the element to be erased

Definition at line 145 of file VectorMap.h.

References std::vector< _Tp, _Alloc >::erase(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase().

    00145 { m_vct.erase ( iter ( pos ) ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 ;

Parameters:

  | key | key for the element to be erased

Returns:
  number of erased elements (0 or 1)

Definition at line 163 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find().

    00164     {
    00165       iterator pos = find ( key ) ;
    00166       if ( end() == pos ) { return 0 ; }
    00167       erase ( pos ) ;
    00168       return 1 ;
    00169     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase | ( | iterator | first,
|  | iterator | last |
| ) |  |  | `[inline]`

erase the sequence of elements using the iterators

Parameters:

  | first | begin iterator of sub-sequence to be erased
  | end | end iterator of the sub_sequence to be erased

Returns:
  number of erased elements

Definition at line 176 of file VectorMap.h.

References std::vector< _Tp, _Alloc >::erase(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00178     {
    00179       m_vct.erase ( iter ( first ) , iter ( last )  ) ;
    00180       return last - first ;
    00181     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
template<class TYPE>

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 ;

Parameters:

  | first | begin-iterator for the sequence of keys
  | last | end-iterator for the sequence of keys

Returns:
  number of erased elements

Definition at line 204 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase().

    00205     {
    00206       size_type res = 0 ;
    00207       for ( ; first != last ; ++first ) { res += erase ( *first ) ; }
    00208       return res ;
    00209     }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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

Attention:
  there is no replacement for the existing key!

It is STL-compliant behavior for associative containers.

      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 ;

Parameters:

  | key | key value to be inserted
  | mapped | value to be associated with the key

Returns:
  position of the inserted elements with the flag which allows to distinguish the actual insertion

Definition at line 253 of file VectorMap.h.

Referenced by TimingAuditor::i_beforeExecute(), TimingAuditor::i_beforeInitialize(), TimingAuditor::initialize(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert().

    00255     { return insert ( value_type ( key , mapped ) ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

result_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | const value_type & | value | ) | `[inline]`

insert the (key,value) pair into the container

Attention:
  there is no replacement for the existing element!

It is STL-compliant behavior for associative containers.

      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 ;

Parameters:

  | value | value to be inserted

Returns:
  position of the inserted elements with the flag which allows to distinguish the actual insertion

Definition at line 298 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), std::pair< _T1, _T2 >::first, std::vector< _Tp, _Alloc >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    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     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 moure efficient

Attention:
  there is no replacement for the existing element!

Parameters:

  | pos | the guess about position where to insert the element
  | value | value to be inserted

Returns:
  position of the inserted elements with the flag which indicated the actual insertion

Definition at line 316 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), std::vector< _Tp, _Alloc >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00318     {
    00319       if ( pos != end() && compare ( *pos , value ) &&
    00320            ( pos == end() - 1 || !compare ( value , *( pos + 1 ) )
    00321              && compare ( *( pos + 1 ) , value ) ) )
    00322       { return result_type( m_vct.insert ( iter ( pos ) , value ) , true ) ; }
    00323       return insert ( value ) ;
    00324     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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

Attention:
  there is no replacement for the existing element!

Parameters:

  | pos | the guess about position where to insert the element
  | key | key value to te inserted
  | mapped | value to be associated with the key

Returns:
  position of the inserted elements with the flag which indicated the actual insertion

Definition at line 336 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert().

    00339     { return insert ( pos , value_type ( key , mapped ) ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
template<class PAIRS>

void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert | ( | PAIRS | first,
|  | PAIRS | last |
| ) |  |  | `[inline]`

insert the sequence of elements into the container

Attention:
  there is no replacement for the existing element!

Parameters:

  | first | the begin iterator of the sequence
  | last | the end iterator of the sequence

Definition at line 348 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert().

    00350     { for ( ; first != last ; ++first ) { insert ( *first ) ; } }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
template<class KEYS, class VALUES>

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

Attention:
  there is no replacement for the existing element!

Parameters:

  | 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 359 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert().

    00362     { for ( ; kf != kl ; ++kf, ++vf ) { insert ( *kf , *vf ) ; } }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 ;
       }

Parameters:

  | key | key to be searched

Returns:
  iterator to the element position in the container

Definition at line 391 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound().

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::at(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::count(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase(), TimingAuditor::i_afterExecute(), TimingAuditor::i_beforeExecute(), TimingAuditor::i_beforeInitialize(), TimingAuditor::initialize(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator()().

    00392     {
    00393       iterator res = lower_bound ( key ) ;
    00394       if ( end() != res && compare ( key , res->first ) )
    00395       { res = end(); }
    00396       return res ;
    00397     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 ;

Parameters:

  | key | key to be searched

Returns:
  number of elements with the given key (0 or 1)

Definition at line 414 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find().

    00415     { return end() == find ( key ) ? 0 : 1 ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound | ( | const key_type & | key | ) | const`[inline]`

Definition at line 417 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and std::lower_bound().

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update().

    00418     { return std::lower_bound ( begin () , end () , key , compare () ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::upper_bound | ( | const key_type & | key | ) | const`[inline]`

Definition at line 419 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and std::upper_bound().

    00420     { return std::upper_bound ( begin () , end () , key , compare () ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

iterators GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::equal_range | ( | const key_type & | key | ) | const`[inline]`

Definition at line 421 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and std::equal_range().

    00422     { return std::equal_range ( begin () , end () , key , compare () ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::empty | ( |  | ) | const`[inline]`

empty container ?

Definition at line 429 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00429 { return m_vct . empty    () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size | ( |  | ) | const`[inline]`

number of elements

Definition at line 431 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by Tuples::TupleObj::fmatrix().

    00431 { return m_vct . size     () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::max_size | ( |  | ) | const`[inline]`

maximal allowed size

Definition at line 433 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00433 { return m_vct . max_size () ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

void GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::clear | ( |  | ) | `[inline]`

clear the container

Definition at line 436 of file VectorMap.h.

References std::vector< _Tp, _Alloc >::clear(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by TimingAuditor::finalize(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::~VectorMap().

    00436 { m_vct.clear   ()       ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 438 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct, and std::vector< _Tp, _Alloc >::reserve().

    00438 { m_vct.reserve ( num )  ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 441 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct, and std::swap().

    00442     {
    00443       std::swap ( m_vct , other.m_vct ) ;
    00444     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator== | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | other | ) | const`[inline]`

comparison criteria for containers

Definition at line 451 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00452     { return m_vct == other.m_vct ; } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator< | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | other | ) | const`[inline]`

comparison criteria for containers

Definition at line 455 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00456     { return m_vct <  other.m_vct ; } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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 exising mapped value.

Attention:
  There is no STL analogue

The method is added on request from ATLAS (see Savannah report #21395 and #21394)

      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

Parameters:

  | key | key value
  | mapped | mapped value

Returns:
  the position of the inserted or modified element

Definition at line 509 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), std::vector< _Tp, _Alloc >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update().

    00511     {
    00512       _iterator result = lower_bound ( key ) ;
    00513       if ( end() == result || compare ( key , result -> first ) )
    00514       { result = m_vct.insert ( result , value_type(key,mapped) ) ; }
    00515       else
    00516       { result->second = mapped ; }
    00517       return iter ( result ) ;
    00518     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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.

Attention:
  There is no STL analogue

The method is added on request from ATLAS (see Savannah report #21395 and #21394)

      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

Parameters:

  | val | a pair of (key,value)

Returns:
  the position of the inserted or modified element

Definition at line 548 of file VectorMap.h.

References std::pair< _T1, _T2 >::first, std::pair< _T1, _T2 >::second, and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update().

    00549     { return update ( val.first , val.second ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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

Attention:
  The behaviour different from std::map, it is similar to GaudiUtils::Map

The method is added on request from ATLAS (see Savannah report #21395 and #21394) For typical usage of this class in LHCb context as "ExtraInfo" field I would like to recommend to AVOID this method

       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!

See also:
  GaudiUtils::Map

Parameters:

  | key | key value

Returns:
  mapped value for existing key and the default value for non-existing key

Definition at line 582 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find().

    00583     {
    00584       static const mapped_type s_default = mapped_type() ;
    00585       iterator res = find ( key ) ;
    00586       if ( end() == res ) { return s_default ; }
    00587       return res->second ;
    00588     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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

Attention:
  The behaviour different from std::map, it is similar to GaudiUtils::Map

The method is added on request from ATLAS (see Savannah report #21395 and #21394) For typical usage of this class in LHCb context as "ExtraInfo" field I would like to recommend to AVOID this method

       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!

See also:
  GaudiUtils::Map

Parameters:

  | key | key value

Returns:
  mapped value

Definition at line 619 of file VectorMap.h.

    00620     { return (*this)( key ) ; } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

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!

Exceptions:

  | std::out_of_range | for non-existing keys

Parameters:

  | key | key value

Returns:
  mapped value

Definition at line 639 of file VectorMap.h.

References GaudiUtils::_throw_out_of_range_exception_(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find().

    00640     {
    00641       iterator res = find ( key ) ;
    00642       if ( end() == res )
    00643       { GaudiUtils::_throw_out_of_range_exception_() ; }
    00644       return res->second ;
    00645     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

VectorMap& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator= | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right | ) | `[inline]`

Definition at line 688 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00689     {
    00690       if ( &right == this ) { return *this ; }
    00691       m_vct = right.m_vct ;
    00692       return *this ;
    00693     }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

const compare_type& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare | ( |  | ) | const`[inline]`

get the comparison criteria itself

Definition at line 702 of file VectorMap.h.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_key(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::equal_range(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::find(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::upper_bound(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap().

    00703     {
    00704       static const  compare_type s_cmp = compare_type() ;
    00705       return s_cmp ;
    00706     }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

const key_compare& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_key | ( |  | ) | const`[inline]`

get the comparison criteria for keys

Definition at line 708 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare().

    00708 { return compare()  ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>
template<class TYPE1, class TYPE2>

bool GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare | ( | const TYPE1 & | obj1,
|  | const TYPE2 & | obj2 |
| ) |  |  | const`[inline, protected]`

compare the objects using the comaprison criteria

Parameters:

  | obj | the first object
  | obj | the second object

Returns:
  result of (obj1,obj2) comparison

Definition at line 726 of file VectorMap.h.

References GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare().

    00728     {
    00729       return compare() ( obj1 , obj2 )  ;
    00730     }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound | ( | const key_type & | key | ) | `[inline, protected]`

'lower-bound' - non-const version

Definition at line 733 of file VectorMap.h.

References std::vector< _Tp, _Alloc >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare(), std::vector< _Tp, _Alloc >::end(), std::lower_bound(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00734     {
    00735       return std::lower_bound
    00736       ( m_vct.begin() , m_vct.end() , key , compare() ) ;
    00737     } ;

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter | ( | iterator | p | ) | `[inline, protected]`

the conversion from 'const' to 'non-const' iterator

Definition at line 739 of file VectorMap.h.

References std::advance(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), std::vector< _Tp, _Alloc >::begin(), std::distance(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update().

    00740     {
    00741       _iterator result = m_vct.begin() ;
    00742       std::advance ( result , std::distance ( begin() , p ) ) ;
    00743       return result ;
    00744     };

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter | ( | _iterator | p | ) | `[inline, protected]`

the conversion from 'non-const' to 'const' iterator

Definition at line 746 of file VectorMap.h.

References std::advance(), std::vector< _Tp, _Alloc >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), std::distance(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct.

    00747     {
    00748       iterator result ( begin() ) ;
    00749       std::advance ( result , std::distance (  m_vct.begin() , p ) ) ;
    00750       return result ;
    00751     }

## Friends And Related Function Documentation

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool operator> | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | left,
|  | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right |
| ) |  |  | `[friend]`

Definition at line 462 of file VectorMap.h.

    00464     { return    right < left     ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool operator!= | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | left,
|  | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right |
| ) |  |  | `[friend]`

Definition at line 466 of file VectorMap.h.

    00468     { return !( left == right  ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool operator>= | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | left,
|  | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right |
| ) |  |  | `[friend]`

Definition at line 470 of file VectorMap.h.

    00472     { return !( left  <  right ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

bool operator<= | ( | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | left,
|  | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & | right |
| ) |  |  | `[friend]`

Definition at line 474 of file VectorMap.h.

    00476     { return !( right <  left  ) ; }

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

std::ostream& operator<< | ( | std::ostream & | str,
|  | const VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR > & |  |
| ) |  |  | `[friend]`

printtut to ostream - not implemented

Definition at line 712 of file VectorMap.h.

    00712 { return str ; }

## Member Data Documentation

template<class KEY, class VALUE, class KEYCOMPARE = std::less<const KEY>, class ALLOCATOR = std::allocator<std::pair<KEY,VALUE> >>

_vector GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::m_vct`[private]`

the underlying sorted vector of (key,mapped) pairs

Definition at line 755 of file VectorMap.h.

Referenced by GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::begin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::clear(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::empty(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::end(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::erase(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::insert(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iter(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::lower_bound(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::max_size(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator<(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator=(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::operator==(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::rbegin(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::rend(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reserve(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::swap(), GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::update(), and GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::VectorMap().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/VectorMap.h