Limi
boost.h
1 // Copyright 2005-2009 Daniel James.
2 // Distributed under the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 
5 #ifndef LIMI_INTERNAL_BOOST_H
6 #define LIMI_INTERNAL_BOOST_H
7 
8 namespace Limi {
9 namespace internal {
10 
11  // functions below are copied from boost. See their copyright notice above.
12 
13  template <class T>
14  inline void hash_combine(std::size_t& seed, T const& v)
15  {
16  std::hash<T> hasher;
17  seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
18  }
19 
20  template <class It>
21  inline std::size_t hash_range(It first, It last)
22  {
23  std::size_t seed = 0;
24 
25  for(; first != last; ++first)
26  {
27  hash_combine(seed, *first);
28  }
29 
30  return seed;
31  }
32 
33  template <class It>
34  inline void hash_range(std::size_t& seed, It first, It last)
35  {
36  for(; first != last; ++first)
37  {
38  hash_combine(seed, *first);
39  }
40  }
41 }
42 }
43 
44 #endif // LIMI_INTERNAL_BOOST_H
The main namespace of the library.
Definition: antichain_algo.h:40