Add geom::point hash
This commit is contained in:
parent
8d1be9aebc
commit
8284ea51bd
1 changed files with 20 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/hash.hpp>
|
||||
|
||||
#include <psemek/geom/detail/array.hpp>
|
||||
#include <psemek/geom/vector.hpp>
|
||||
|
||||
|
|
@ -199,3 +201,21 @@ namespace psemek::geom
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct hash<::psemek::geom::point<T, N>>
|
||||
{
|
||||
std::size_t operator()(::psemek::geom::point<T, N> const & v) const noexcept
|
||||
{
|
||||
std::hash<T> h;
|
||||
std::size_t r = 0;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
::psemek::util::hash_combine(r, h(v[i]));
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue