2 #ifndef vbl_batch_multimap_h_ 3 #define vbl_batch_multimap_h_ 18 # include <vcl_msvc_warnings.h> 28 template <
typename K,
typename T,
typename C=std::less<K> >
34 typedef typename std::pair<key_type, mapped_type>
value_type;
57 {
return comp(x.first, y.first); }
60 {
return comp(x.first, y.first); }
66 template <
typename CI>
74 template <
typename CI>
77 data_.assign(start, finish);
83 template <
typename CI>
86 data_.assign(start, finish);
115 return std::lower_bound(
data_.begin(),
data_.end(),
124 return std::upper_bound(
data_.begin(),
data_.end(),
131 return std::equal_range(
data_.begin(),
data_.end(),
139 if (it !=
end() && it->first != key)
148 std::pair<const_iterator, const_iterator> range =
equal_range(key);
149 return range.second - range.first;
156 template <
typename CI,
typename CMP>
159 if (start ==
end)
return true;
161 for (
end--; start!=
end; ++start)
163 if ( comp(*(start+1), *start))
return false;
170 template<
typename K,
typename T,
typename C>
176 #endif // vbl_batch_multimap_h_ std::vector< value_type > container_type
container_type::const_iterator const_iterator
std::pair< const_iterator, const_iterator > equal_range(const key_type &key) const
A more efficient make_pair(lower_bound(...), upper_bound(...)).
A fast read and batch-write map-style collection.
container_type::const_reference const_reference
bool operator()(const value_type &x, const value_type &y) const
void assign_sorted(CI start, CI finish)
Change all the values in the multimap, to a ready sorted sequence.
const_iterator find(const key_type &key) const
Finds the first matching value in the sequence, or returns end() if no match,.
const_iterator upper_bound(const key_type &key) const
Finds the one past the end of a subsequence matching given key.
void swap(vbl_batch_multimap< K, T, C > &x, vbl_batch_multimap< K, T, C > &y)
vbl_batch_multimap(CI start, CI finish)
bool compare(const value_type &x, const value_type &y) const
const_iterator lower_bound(const key_type &key) const
Finds the beginning of a subsequence matching given key.
std::size_t count(const key_type &key) const
Finds the number of elements with matching key,.
container_type::allocator_type allocator_type
bool operator==(const vbl_batch_multimap &rhs)
void swap(vbl_batch_multimap &rhs)
value_compare_t(key_compare c)
static bool is_sorted(CI start, CI end, CMP comp)
std::pair< key_type, mapped_type > value_type
const_iterator end() const
void assign(CI start, CI finish)
Change all the values in the multimap.
const_iterator begin() const