flat maps/sets

This commit is contained in:
Doug Hoyte
2023-01-29 17:31:28 -05:00
parent 5117485ebf
commit 8d0c9952ab
15 changed files with 42 additions and 31 deletions

View File

@ -1,5 +1,7 @@
#pragma once
#include <parallel_hashmap/phmap_utils.h>
#include "filters.h"
@ -28,10 +30,19 @@ struct SubId {
std::string str() const {
return std::string(sv());
}
bool operator==(const SubId &o) const {
return o.sv() == sv();
}
};
inline bool operator <(const SubId &s1, const SubId &s2) {
return s1.sv() < s2.sv();
namespace std {
// inject specialization of std::hash
template<> struct hash<SubId> {
std::size_t operator()(SubId const &p) const {
return phmap::HashState().combine(0, p.sv());
}
};
}