Delete unused class PairHash
Partial revert of
https://webrtc-review.googlesource.com/c/src/+/216243, this class is
no longer needed, after
https://webrtc-review.googlesource.com/c/src/+/229182 replaced usage
of unordered_map with flat_map.
Bug: webrtc:12689
Change-Id: I56e4d9326334b78eb09d471ded752e58601f4abf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231235
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34941}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index ac1b813..6cc6be1 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -119,7 +119,6 @@
"copy_on_write_buffer.h",
"event_tracer.cc",
"event_tracer.h",
- "hash.h",
"location.cc",
"location.h",
"numerics/histogram_percentile_counter.cc",
@@ -1351,7 +1350,6 @@
"deprecated/recursive_critical_section_unittest.cc",
"event_tracer_unittest.cc",
"event_unittest.cc",
- "hash_unittest.cc",
"logging_unittest.cc",
"numerics/divide_round_unittest.cc",
"numerics/histogram_percentile_counter_unittest.cc",
diff --git a/rtc_base/hash.h b/rtc_base/hash.h
deleted file mode 100644
index 56d581c..0000000
--- a/rtc_base/hash.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef RTC_BASE_HASH_H_
-#define RTC_BASE_HASH_H_
-
-#include <stddef.h>
-
-#include <functional>
-#include <utility>
-
-namespace webrtc {
-
-// A custom hash function for std::pair, to be able to be used as key in a
-// std::unordered_map. If absl::flat_hash_map would ever be used, this is
-// unnecessary as it already has a hash function for std::pair.
-struct PairHash {
- template <class T1, class T2>
- size_t operator()(const std::pair<T1, T2>& p) const {
- return (3 * std::hash<T1>{}(p.first)) ^ std::hash<T2>{}(p.second);
- }
-};
-
-} // namespace webrtc
-
-#endif // RTC_BASE_HASH_H_
diff --git a/rtc_base/hash_unittest.cc b/rtc_base/hash_unittest.cc
deleted file mode 100644
index e86c8a8..0000000
--- a/rtc_base/hash_unittest.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "rtc_base/hash.h"
-
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-
-#include "test/gmock.h"
-
-namespace webrtc {
-namespace {
-
-TEST(PairHashTest, CanInsertIntoSet) {
- using MyPair = std::pair<int, int>;
-
- std::unordered_set<MyPair, PairHash> pairs;
-
- pairs.insert({1, 2});
- pairs.insert({3, 4});
-
- EXPECT_NE(pairs.find({1, 2}), pairs.end());
- EXPECT_NE(pairs.find({3, 4}), pairs.end());
- EXPECT_EQ(pairs.find({1, 3}), pairs.end());
- EXPECT_EQ(pairs.find({3, 3}), pairs.end());
-}
-
-TEST(PairHashTest, CanInsertIntoMap) {
- using MyPair = std::pair<std::string, int>;
-
- std::unordered_map<MyPair, int, PairHash> pairs;
-
- pairs[{"1", 2}] = 99;
- pairs[{"3", 4}] = 100;
-
- EXPECT_EQ((pairs[{"1", 2}]), 99);
- EXPECT_EQ((pairs[{"3", 4}]), 100);
- EXPECT_EQ(pairs.find({"1", 3}), pairs.end());
- EXPECT_EQ(pairs.find({"3", 3}), pairs.end());
-}
-} // namespace
-} // namespace webrtc