|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_MapOfVectors_h
2 #define DataFormats_Common_MapOfVectors_h
8 #include <boost/range/iterator_range.hpp>
9 #include <boost/iterator/iterator_facade.hpp>
11 class TestMapOfVectors;
18 template <
typename K,
typename T>
22 typedef std::map<K, std::vector<T> >
TheMap;
26 typedef std::vector<K>
Keys;
28 typedef std::vector<T>
Data;
34 typedef boost::iterator_range<data_iterator>
range;
36 typedef std::pair<K, range>
Pair;
38 class Iter :
public boost::iterator_facade<Iter, Pair const, boost::forward_traversal_tag> {
80 for (
typename TheMap::const_iterator
p = it.begin();
p != it.end(); ++
p)
81 tot += (*p).second.size();
83 for (
typename TheMap::const_iterator
p = it.begin();
p != it.end(); ++
p)
99 std::pair<key_iterator, key_iterator>
p = std::equal_range(
m_keys.begin(),
m_keys.end(),
k);
100 return (
p.first !=
p.second) ?
p.first :
m_keys.end();
139 friend class ::TestMapOfVectors;
147 template <
typename K,
typename T>
154 #endif // DatFormats_Common_MapOfVectors_h
void swap(Association< C > &lhs, Association< C > &rhs)
Iter(key_iterator k, offset_iterator o, std::vector< T > const &d)
bool equal(self const &other) const
key_iterator findKey(K const &k) const
friend class boost::iterator_core_access
const_iterator begin() const
The iterator returned can not safely be used across threads.
void loadNext(K const &k, std::vector< T > const &v)
MapOfVectors & operator=(MapOfVectors const &rhs)
size_type offset(K const &k) const
std::map< K, std::vector< T > > TheMap
const_iterator end() const
Pair const & dereference() const
std::vector< size_type > Offsets
Keys::const_iterator key_iterator
Offsets::const_iterator offset_iterator
boost::iterator_range< data_iterator > range
range find(K const &k) const
std::vector< size_type > m_offsets
void swap(MapOfVectors &other)
Data::const_iterator data_iterator
std::pair< K, range > Pair
MapOfVectors(TheMap const &it)