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();
133 friend class ::TestMapOfVectors;
141 template <
typename K,
typename T>
148 #endif // DatFormats_Common_MapOfVectors_h
Iter(key_iterator k, offset_iterator o, std::vector< T > const &d)
Pair const & dereference() const
Keys::const_iterator key_iterator
MapOfVectors(TheMap const &it)
void loadNext(K const &k, std::vector< T > const &v)
Offsets::const_iterator offset_iterator
void swap(MapOfVectors &other)
std::map< K, std::vector< T > > TheMap
range find(K const &k) const
std::vector< size_type > m_offsets
void swap(Association< C > &lhs, Association< C > &rhs)
std::pair< K, range > Pair
friend class boost::iterator_core_access
key_iterator findKey(K const &k) const
std::vector< size_type > Offsets
Data::const_iterator data_iterator
bool equal(self const &other) const
const_iterator end() const
boost::iterator_range< data_iterator > range
const_iterator begin() const
The iterator returned can not safely be used across threads.
size_type offset(K const &k) const