make uuid_t hashable
This commit is contained in:
parent
7dc1ba4a6d
commit
eb832213a0
1 changed files with 11 additions and 0 deletions
|
|
@ -117,6 +117,17 @@ struct is_map_key_type_same_as_enum {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// hash operator to be able use uuid_t as a hashmap key
|
||||||
|
template<>
|
||||||
|
struct std::hash<db::uuid_t> {
|
||||||
|
std::size_t operator()(const db::uuid_t& k) const {
|
||||||
|
using std::size_t;
|
||||||
|
using std::hash;
|
||||||
|
|
||||||
|
return hash<size_t>()(hash<uint64_t>()(k.uuid_upper) ^ hash<uint64_t>()(k.uuid_lower));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate type conversion for enum class macros in the libpqxx library
|
* @brief Generate type conversion for enum class macros in the libpqxx library
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue