From 75e360b8b3147ee7ef3e3dd932cc874fb8a06de8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Mon, 28 Sep 2020 17:21:12 +0300 Subject: [PATCH] mdbx++: add `std::hash<>` specialization for `mdbx::slice`. Change-Id: I4402122f0f088bfa8eea753df931537cfe935086 --- mdbx.h++ | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mdbx.h++ b/mdbx.h++ index 6d0b64d5..7046369d 100644 --- a/mdbx.h++ +++ b/mdbx.h++ @@ -4624,6 +4624,15 @@ inline std::string to_string(const ::MDBX_error_t &errcode) { } // namespace mdbx +namespace std { +template <> struct hash { + MDBX_CXX14_CONSTEXPR size_t + operator()(mdbx::slice const &slice) const noexcept { + return slice.hash_value(); + } +}; +} // namespace std + #ifdef _MSC_VER #pragma warning(pop) #endif