DGtal  0.9.2
PointHashFunctions.h
1 
17 #pragma once
18 
29 #if defined(PointHashFunctions_RECURSES)
30 #error Recursive header files inclusion detected in PointHashFunctions.h
31 #else // defined(PointHashFunctions_RECURSES)
32 
33 #define PointHashFunctions_RECURSES
34 
35 #if !defined PointHashFunctions_h
36 
37 #define PointHashFunctions_h
38 
40 // Inclusions
41 #include <iostream>
42 #include "DGtal/base/Common.h"
43 #include "DGtal/kernel/PointVector.h"
44 #include "DGtal/kernel/NumberTraits.h"
45 #include "DGtal/base/BasicTypes.h"
46 #include <functional>
47 #include <boost/functional/hash.hpp>
49 
50 
57 namespace std {
58  template <DGtal::Dimension dim,
59  typename EuclideanRing,
60  typename Container>
61  struct hash< DGtal::PointVector<dim,EuclideanRing,Container> >
62  {
64  {
65  return boost::hash_range(p.begin(), p.end());
66  }
67  };
68 }
69 
70 #ifdef WITH_GMP
71 namespace std
72 {
73  template <>
74  struct hash< DGtal::BigInteger >
75  {
76  size_t operator()(const DGtal::BigInteger & p) const
77  {
79  }
80  };
81 }
82 //Also defining boost::hash since boost::hash_range needs it.
83 namespace boost
84 {
85  template <>
86  struct hash< DGtal::BigInteger > : std::hash<DGtal::BigInteger>
87  { };
88 }
89 #endif
90 
91 
92 
93 #endif // !defined PointHashFunctions_h
94 
95 #undef PointHashFunctions_RECURSES
96 #endif // else defined(PointHashFunctions_RECURSES)
Definition: Boost.dox:28
DGtal::uint32_t Dimension
Definition: Common.h:113
STL namespace.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
size_t operator()(const DGtal::BigInteger &p) const
static DGtal::int64_t castToInt64_t(const T &aT)
Definition: NumberTraits.h:146
size_t operator()(const DGtal::PointVector< dim, EuclideanRing, Container > &p) const
DGtal is the top-level namespace which contains all DGtal functions and types.