diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index ac1b813805..6cc6be1212 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -119,7 +119,6 @@ rtc_library("rtc_base_approved") { "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 @@ if (rtc_include_tests) { "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 56d581cdf1..0000000000 --- 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 - -#include -#include - -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 - size_t operator()(const std::pair& p) const { - return (3 * std::hash{}(p.first)) ^ std::hash{}(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 e86c8a8586..0000000000 --- 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 -#include -#include - -#include "test/gmock.h" - -namespace webrtc { -namespace { - -TEST(PairHashTest, CanInsertIntoSet) { - using MyPair = std::pair; - - std::unordered_set 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::unordered_map 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