Vcsn  2.8
Be Rational
vector.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <algorithm>
4 #include <vector>
5 
6 #include <boost/range/algorithm/find.hpp>
7 
9 #include <vcsn/misc/functional.hh> // hash_combine
10 
11 namespace vcsn
12 {
13  namespace detail
14  {
16  template <typename Cont>
17  std::vector<typename Cont::value_type>
18  make_vector(const Cont& cont)
19  {
20  using std::begin;
21  using std::end;
22  return {begin(cont), end(cont)};
23  }
24  }
25 
27  template <typename T, typename Alloc>
28  ATTRIBUTE_PURE
29  bool
30  has(const std::vector<T, Alloc>& s, const T& e)
31  {
32  return boost::find(s, e) != std::end(s);
33  }
34 }
35 
36 namespace std
37 {
38  template <typename T, typename Alloc>
39  struct hash<vector<T, Alloc>>
40  {
41  size_t operator()(const std::vector<T, Alloc>& vs) const
42  {
43  auto res = size_t{0};
44  for (const auto& v: vs)
46  return res;
47  }
48  };
49 }
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:26
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
Definition: vector.hh:18
Definition: a-star.hh:8
size_t operator()(const std::vector< T, Alloc > &vs) const
Definition: vector.hh:41
void hash_combine(std::size_t &seed, const T &v)
Definition: functional.hh:63
STL namespace.
return res
Definition: multiply.hh:399