Vcsn  2.4
Be Rational
set.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <algorithm> // set_intersection
4 #include <set>
5 
8 
9 namespace std
10 {
11 
12  /*---------------.
13  | hash(set<T>). |
14  `---------------*/
15 
16  template <typename T, typename Compare, typename Alloc>
17  struct hash<set<T, Compare, Alloc>>
18  {
19  using type = set<T, Compare, Alloc>;
20  size_t operator()(const type& ss) const
21  {
22  size_t res = 0;
23  for (const auto& s: ss)
24  hash_combine(res, s);
25  return res;
26  }
27  };
28 }
29 
30 namespace vcsn
31 {
33  template <typename T, typename Compare, typename Alloc>
34  bool
35  has(const std::set<T, Compare, Alloc>& s, const T& e)
36  ATTRIBUTE_PURE;
37 
39  template <typename T, typename Compare, typename Alloc>
40  std::set<std::set<T, Compare, Alloc>>
41  intersection_closure(std::set<std::set<T, Compare, Alloc>> pset);
42 
44  template <typename T, typename Compare, typename Alloc>
45  std::ostream&
46  print(const std::set<T, Compare, Alloc>& set, std::ostream& o);
47 
49  template <typename Container>
50  bool subset(const Container& set1, const Container& set2)
51  ATTRIBUTE_PURE;
52 }
53 
54 #include <vcsn/misc/set.hxx>
STL namespace.
return res
Definition: multiply.hh:398
std::set< std::set< T, Compare, Alloc > > intersection_closure(std::set< std::set< T, Compare, Alloc >> pset)
The set of all the intersections of the sets in pset.
Definition: set.hxx:17
size_t operator()(const type &ss) const
Definition: set.hh:20
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
Definition: print.hh:83
Definition: a-star.hh:8
set< T, Compare, Alloc > type
Definition: set.hh:19
bool subset(const Container &set1, const Container &set2) ATTRIBUTE_PURE
Whether set1 ⊆ set2.
Definition: set.hxx:48
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
void hash_combine(std::size_t &seed, const T &v)
Definition: functional.hh:48
Request the set implementation (bool weights).