Vcsn  2.4
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  size_t
12  collision_count(const std::unordered_map<Key, T, Hash, KeyEqual, Alloc>& m)
13  {
14  size_t res = 0;
15  for (size_t i = 0; i < m.bucket_count(); ++i)
16  res += m.bucket_size(i);
17  return res;
18  }
19 
21  template <typename Key, typename T,
22  typename Hash, typename KeyEqual, typename Alloc>
23  bool
24  has(const std::unordered_map<Key, T, Hash, KeyEqual, Alloc>& m,
25  const Key& k)
26  {
27  return m.find(k) != std::end(m);
28  }
29 }
return res
Definition: multiply.hh:398
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