Vcsn  2.3
Be Rational
dynamic_bitset.hh
Go to the documentation of this file.
1 #pragma once
2 
3 // http://stackoverflow.com/questions/3896357/
4 #define BOOST_DYNAMIC_BITSET_DONT_USE_FRIENDS
5 #include <boost/dynamic_bitset.hpp>
6 
7 #include <boost/functional/hash.hpp>
8 
10 
11 namespace std
12 {
13  template <typename B, typename A>
14  struct hash<boost::dynamic_bitset<B, A>>
15  {
16  size_t operator()(const boost::dynamic_bitset<B, A>& bs) const
17  {
18  size_t res = boost::hash_value(bs.m_num_bits);
20  return res;
21  }
22  };
23 
25  template <typename B, typename A, typename Key>
26  bool
27  has(const boost::dynamic_bitset<B, A>& s, const Key& e)
28  {
29  return s.test(e);
30  }
31 }
32 
33 namespace vcsn
34 {
35  using dynamic_bitset = boost::dynamic_bitset<>;
36 
37  template <typename Container>
39  make_dynamic_bitset(const Container& c, size_t size)
40  {
41  auto res = dynamic_bitset(size);
42  for (auto s: c)
43  res.set(s);
44  return res;
45  }
46 }
STL namespace.
boost::dynamic_bitset<> dynamic_bitset
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
return res
Definition: multiply.hh:398
size_t operator()(const boost::dynamic_bitset< B, A > &bs) const
auto hash_value(const T &v) -> decltype(std::hash< T >
Following the naming convention of Boost.
Definition: functional.hh:30
dynamic_bitset make_dynamic_bitset(const Container &c, size_t size)
Definition: a-star.hh:8
void hash_combine_hash(std::size_t &seed, size_t h)
Definition: functional.hh:41