From: Clifford Wolf Date: Tue, 7 Apr 2015 15:23:30 +0000 (+0200) Subject: Added hashlib support for std::tuple<> X-Git-Tag: yosys-0.6~349 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aae5f2ca0873d3a2a96f51d70b3b5bc2f2d0bcf9;p=yosys.git Added hashlib support for std::tuple<> --- diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 7cea195d5..b6cedc496 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;