Vcsn  2.2
Be Rational
unordered_map.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <unordered_map>
4 
5 namespace vcsn
6 {
7 
9  template <typename Key, typename T,
10  typename Hash, typename KeyEqual, typename Alloc>
11  inline
12  size_t
13  collision_count(const std::unordered_map<Key, T, Hash, KeyEqual, Alloc>& m)
14  {
15  size_t res = 0;
16  for (size_t i = 0; i < m.bucket_count(); ++i)
17  res += m.bucket_size(i);
18  return res;
19  }
20 
22  template <typename Key, typename T,
23  typename Hash, typename KeyEqual, typename Alloc>
24  inline
25  bool
26  has(const std::unordered_map<Key, T, Hash, KeyEqual, Alloc>& m,
27  const Key& k)
28  {
29  return m.find(k) != std::end(m);
30  }
31 }
Definition: a-star.hh:8
size_t collision_count(const std::unordered_map< Key, T, Hash, KeyEqual, Alloc > &m)
Sum of bucket sizes.
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
Definition: setalpha.hh:25