10namespace dlinear::drake {
14size_t hash_combine(
size_t seed,
const T &v);
16template<
class T,
class... Rest>
17size_t hash_combine(
size_t seed,
const T &v, Rest... rest) {
18 return hash_combine(hash_combine(seed, v), rest...);
23size_t hash_range(It first, It last) {
25 for (; first != last; ++first) {
26 seed = hash_combine(seed, *first);
34 size_t operator()(
const T &v)
const {
return std::hash<T>{}(v); }
38template<
class T1,
class T2>
40 size_t operator()(
const std::pair<T1, T2> &p)
const {
41 return hash_combine(0, p.first, p.second);
48 size_t operator()(
const std::vector<T> &vec)
const {
49 return hash_range(vec.begin(), vec.end());
56 size_t operator()(
const std::set<T> &s)
const {
57 return hash_range(s.begin(), s.end());
62template<
class T1,
class T2>
64 size_t operator()(
const std::map<T1, T2> &
map)
const {
65 return hash_range(
map.begin(),
map.end());
72inline size_t hash_combine(
size_t seed,
const T &v) {
73 seed ^=
hash_value<T>{}(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
std::set< Formula > map(const std::set< Formula > &formulas, const std::function< Formula(const Formula &)> &func)
Given formulas = {fâ, ..., fâ} and a func : Formula â Formula, map(formulas, func) returns a set {fun...
Computes the hash value of v using std::hash.