Vcsn  2.1
Be Rational
pair.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/misc/functional.hh> // hash_combine
4 
5 namespace std
6 {
7 
8  /*-----------------.
9  | hash(pair<T>). |
10  `-----------------*/
11 
12  template <typename T1, typename T2>
13  struct hash<pair<T1, T2>>
14  {
15  size_t operator()(const pair<T1, T2>& p) const
16  {
17  size_t res = 0;
18  vcsn::hash_combine(res, p.first);
19  vcsn::hash_combine(res, p.second);
20  return res;
21  }
22  };
23 }
24 
25 
26 namespace vcsn
27 {
28 
29  /*---------------------------------.
30  | make_ordered_pair(e1<T>, e2<T>). |
31  `---------------------------------*/
32 
33  template <typename T>
34  std::pair<T, T> make_ordered_pair(T e1, T e2)
35  {
36  return e1 < e2 ? std::make_pair(e1, e2) : std::make_pair(e2, e1);
37  }
38 }
STL namespace.
std::pair< T, T > make_ordered_pair(T e1, T e2)
Definition: pair.hh:34
automaton pair(const automaton &aut, bool keep_initials)
Bridge.
Definition: pair.hh:255
void hash_combine(std::size_t &seed, const T &v)
Definition: functional.hh:32
size_t operator()(const pair< T1, T2 > &p) const
Definition: pair.hh:15