Still need a better way identify left/right sidedness

This commit is contained in:
2024-02-09 15:17:37 -08:00
parent f3e7279c2c
commit 80a79aab1f
3 changed files with 108 additions and 19 deletions

View File

@@ -4,6 +4,7 @@
#include <bit>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
@@ -184,9 +185,20 @@ template <class T> using Set = std::set<T, std::less<T>, ArenaAlloc<T>>;
template <class T> auto set(Arena &arena) {
return Set<T>(ArenaAlloc<T>(&arena));
}
template <class T> struct MyHash;
template <class T> struct MyHash<T *> {
size_t operator()(const T *t) const noexcept {
size_t result;
memcpy(&result, &t, sizeof(result));
return result;
}
};
template <class T>
using HashSet =
std::unordered_set<T, std::hash<T>, std::equal_to<T>, ArenaAlloc<T>>;
std::unordered_set<T, MyHash<T>, std::equal_to<T>, ArenaAlloc<T>>;
template <class T> auto hashSet(Arena &arena) {
return HashSet<T>(ArenaAlloc<T>(&arena));
}
@@ -449,7 +461,7 @@ template <class ConflictSetImpl> struct TestDriver {
ConflictSetImpl cs{writeVersion};
ReferenceImpl refImpl{writeVersion};
constexpr static auto kMaxKeyLen = 24;
constexpr static auto kMaxKeyLen = 32;
bool ok = true;