From cc1518dbf05f60c5ac480209c96a48a98d01455f Mon Sep 17 00:00:00 2001 From: Tom Jackson Date: Wed, 8 Aug 2012 16:47:01 -0700 Subject: [PATCH] Removing broken specialization of std::hash Summary: ^ Test Plan: Unit tests Reviewed By: delong.j@fb.com FB internal diff: D543586 --- folly/Hash.h | 9 --------- folly/test/HashTest.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/folly/Hash.h b/folly/Hash.h index efe0f047194..52676e55482 100644 --- a/folly/Hash.h +++ b/folly/Hash.h @@ -338,15 +338,6 @@ namespace std { return folly::hash::hash_combine(x.first, x.second); } }; - - // Same as above, but for arbitrary tuples. - template - class hash > { - public: - size_t operator()(const Ts&... ts) const { - return folly::hash::hash_combine(ts...); - } - }; } // namespace std #endif diff --git a/folly/test/HashTest.cpp b/folly/test/HashTest.cpp index 954b6b6d299..dc3d403c690 100644 --- a/folly/test/HashTest.cpp +++ b/folly/test/HashTest.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace folly::hash; @@ -172,6 +173,16 @@ TEST(Hash, hasher) { EXPECT_EQ(get_default(m, 4), 5); } +TEST(Hash, pair) { + auto a = std::make_pair(1, 2); + auto b = std::make_pair(3, 4); + auto c = std::make_pair(1, 2); + EXPECT_EQ(hash_combine(a), + hash_combine(c)); + EXPECT_NE(hash_combine(b), + hash_combine(c)); +} + TEST(Hash, hash_combine) { EXPECT_NE(hash_combine(1, 2), hash_combine(2, 1)); }