DGtal 1.3.0
Loading...
Searching...
No Matches
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)
33#define PointHashFunctions_RECURSES
34
35#if !defined PointHashFunctions_h
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
57namespace 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
71namespace 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.
83namespace 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)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:137
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
Definition: Boost.dox:28
STL namespace.
static DGtal::int64_t castToInt64_t(const std::decay< T >::type &aT)
Cast method to DGtal::int64_t (for I/O or board export uses only).
Definition: NumberTraits.h:145
size_t operator()(const DGtal::BigInteger &p) const
size_t operator()(const DGtal::PointVector< dim, EuclideanRing, Container > &p) const