Vcsn  2.3a
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 #include <vcsn/misc/tuple.hh> // make_index_sequence.
11 
12 namespace vcsn
13 {
14 
15  namespace detail
16  {
18  template <typename Cont>
19  std::vector<typename Cont::value_type>
20  make_vector(const Cont& cont)
21  {
22  using std::begin;
23  using std::end;
24  return {begin(cont), end(cont)};
25  }
26  }
27 
29  template <typename T, typename Alloc>
30  ATTRIBUTE_PURE
31  bool
32  has(const std::vector<T, Alloc>& s, const T& e)
33  {
34  return boost::find(s, e) != std::end(s);
35  }
36 }
37 
38 namespace std
39 {
40  template <typename T, typename Alloc>
41  struct hash<vector<T, Alloc>>
42  {
43  size_t operator()(const std::vector<T, Alloc>& vs) const
44  {
45  auto res = size_t{0};
46  for (const auto& v: vs)
48  return res;
49  }
50  };
51 }
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
return v
Definition: multiply.hh:361
Definition: a-star.hh:8
return res
Definition: multiply.hh:398
void hash_combine(std::size_t &seed, const T &v)
Definition: functional.hh:48
size_t operator()(const std::vector< T, Alloc > &vs) const
Definition: vector.hh:43
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
Definition: vector.hh:20
STL namespace.