diff --git a/coord/ops.hpp b/coord/ops.hpp index 765cb77f..52cab527 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -934,9 +934,9 @@ namespace util { } +/////////////////////////////////////////////////////////////////////////////// #include - namespace std { /// returns the dimensions of a coordinate type. /// @@ -985,4 +985,35 @@ namespace std { } +/////////////////////////////////////////////////////////////////////////////// +#include + +#include "../hash.hpp" + +namespace std { + template < + size_t S, + typename T, + template < + std::size_t,typename + > class K + > + struct hash< + K + > : public ::std::enable_if< + ::util::is_coord_v> + > { + std::size_t + operator() (K k) const { + size_t v = 0xdeadbeef; + + for (auto t: k) + v = ::util::hash::mix (t, v); + + return v; + } + }; +} + + #endif diff --git a/point.hpp b/point.hpp index 8a4d11cf..3bc78d59 100644 --- a/point.hpp +++ b/point.hpp @@ -103,23 +103,6 @@ namespace util { typedef point4 point4i; } -#include - -namespace std { - template - struct hash> { - size_t operator() (util::point p) const { - std::hash h; - - size_t k = 0; - for (size_t i = 0; i < S; ++i) - k = h (p.data[i] ^ k); - - return k; - } - }; -} - #include "point.ipp" #endif // __UTIL_POINT_HPP