From aae5f2ca0873d3a2a96f51d70b3b5bc2f2d0bcf9 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 7 Apr 2015 17:23:30 +0200 Subject: Added hashlib support for std::tuple<> --- kernel/hashlib.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'kernel') diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 7cea195d..b6cedc49 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -92,6 +92,21 @@ template struct hash_ops> { } }; +template struct hash_ops> { + static inline bool cmp(std::tuple a, std::tuple b) { + return a == b; + } + template + static inline typename std::enable_if::type hash(std::tuple) { + return mkhash_init; + } + template + static inline typename std::enable_if::type hash(std::tuple a) { + hash_ops>::type> element_ops; + return mkhash(hash(a), element_ops.hash(std::get(a))); + } +}; + template struct hash_ops> { static inline bool cmp(std::vector a, std::vector b) { return a == b; -- cgit v1.2.3