diff options
author | Alex Zolotarev <alex@maps.me> | 2015-06-24 15:47:00 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:52:33 +0300 |
commit | a2bbe7a4e180b996e73e183d53bc05f22618fa21 (patch) | |
tree | 3806d15f3450d9bfc8425991d17f5061bbc29c58 /geometry | |
parent | d8eebb597792cc47564bb18d188be35232260506 (diff) |
boost::hash -> std::hash
TODO: Should we improve current hash implementation/review do we really need unordered sets/maps?
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/point2d.hpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/geometry/point2d.hpp b/geometry/point2d.hpp index d4e61f2620..46d394f7ea 100644 --- a/geometry/point2d.hpp +++ b/geometry/point2d.hpp @@ -7,9 +7,10 @@ #include "std/array.hpp" #include "std/cmath.hpp" +#include "std/functional.hpp" #include "std/sstream.hpp" #include "std/typeinfo.hpp" -#include "std/unordered_map.hpp" + namespace m2 { @@ -178,6 +179,14 @@ namespace m2 x = org.x + oldX * dx.x + y * dy.x; y = org.y + oldX * dx.y + y * dy.y; } + + struct Hash + { + size_t operator()(m2::Point<T> const & p) const + { + return my::Hash(p.x, p.y); + } + }; }; template <typename T> @@ -392,16 +401,3 @@ bool AlmostEqualULPs(m2::Point<T> const & p1, m2::Point<T> const & p2, unsigned } } - -// hash function for unordered map realisation. -namespace boost -{ -template <> -struct hash<m2::PointD> -{ - size_t operator()(m2::PointD const & p) const - { - return (hash<double>()(p.x) ^ (hash<double>()(p.y) >> 1)); - } -}; -} |