Add geom::simplex hash
This commit is contained in:
parent
8b456ce9e9
commit
ac436cb155
1 changed files with 19 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <psemek/geom/point.hpp>
|
#include <psemek/geom/point.hpp>
|
||||||
|
#include <psemek/util/hash.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
@ -131,3 +132,21 @@ namespace psemek::geom
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
|
template <typename Point, std::size_t K>
|
||||||
|
struct hash<::psemek::geom::simplex<Point, K>>
|
||||||
|
{
|
||||||
|
std::size_t operator()(::psemek::geom::simplex<Point, K> const & simplex) const
|
||||||
|
{
|
||||||
|
std::size_t result = 0;
|
||||||
|
std::hash<Point> h;
|
||||||
|
for (auto const & p : simplex.points)
|
||||||
|
::psemek::util::hash_combine(result, h(p));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue