summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-11-17 10:01:24 -0800
committerGravatar dinord <dino.radakovich@gmail.com>2021-11-17 22:50:31 -0500
commit299f59cadda78dfaf71b2a35049b63911e8eff47 (patch)
tree1ae52c169d809eeaa6d91b996fd9f067c26a8f39 /absl/container
parent9b924cedb6127dfb8f5d504a419dead2899fa777 (diff)
Export of internal Abseil changes
-- 2130ba98c8359b08d97fb16d84dfd05687005dcf by Abseil Team <absl-team@google.com>: Tweaking the documentation of c_all_of to state the effect more directly. PiperOrigin-RevId: 410557900 -- 4732289bf4b56123fed113e36be4710b55c6a6c7 by Greg Falcon <gfalcon@google.com>: Improve the quality of absl::Hash<std::vector<bool>>. This previously dispatched to std::hash<vector<bool>>, which suffers from trivial collisions on many platforms. (They often hash the internal words but no size info, so that, e.g., {1, 1} and {1, 1, 0} collide.) Also extended the unit test to exercise this. PiperOrigin-RevId: 410329943 -- 1c5f3934230a7669f74c96b305251786a265e235 by Greg Falcon <gfalcon@google.com>: Add broader testing of absl hash contracts in the hash unit test. In particular, test that the hash erasure mechanism works. PiperOrigin-RevId: 410312738 -- 5e1923f527ed3d02f6752a5b38d5e1c17a4a146f by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 410290663 -- 8c74bc962b3b98a5908017c345efc592393048ea by Martijn Vels <mvels@google.com>: Add Cord::CreateFlat() function PiperOrigin-RevId: 410260776 -- bd0de4e94c85620d3b8dd60fae367b730fc4cb34 by Evan Brown <ezb@google.com>: Rename node_hash_policy to node_slot_policy. Motivation: we can potentially reuse this code for node_btree_*. PiperOrigin-RevId: 410082271 GitOrigin-RevId: 2130ba98c8359b08d97fb16d84dfd05687005dcf Change-Id: Ie052084cf992dee250d8b2f388d39c4de0dcff40
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/BUILD.bazel14
-rw-r--r--absl/container/CMakeLists.txt14
-rw-r--r--absl/container/internal/node_slot_policy.h (renamed from absl/container/internal/node_hash_policy.h)8
-rw-r--r--absl/container/internal/node_slot_policy_test.cc (renamed from absl/container/internal/node_hash_policy_test.cc)4
-rw-r--r--absl/container/node_hash_map.h4
-rw-r--r--absl/container/node_hash_set.h4
6 files changed, 24 insertions, 24 deletions
diff --git a/absl/container/BUILD.bazel b/absl/container/BUILD.bazel
index ffaee19c..ea2c98b8 100644
--- a/absl/container/BUILD.bazel
+++ b/absl/container/BUILD.bazel
@@ -307,7 +307,7 @@ cc_library(
deps = [
":container_memory",
":hash_function_defaults",
- ":node_hash_policy",
+ ":node_slot_policy",
":raw_hash_map",
"//absl/algorithm:container",
"//absl/memory",
@@ -339,7 +339,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":hash_function_defaults",
- ":node_hash_policy",
+ ":node_slot_policy",
":raw_hash_set",
"//absl/algorithm:container",
"//absl/memory",
@@ -535,21 +535,21 @@ cc_test(
)
cc_library(
- name = "node_hash_policy",
- hdrs = ["internal/node_hash_policy.h"],
+ name = "node_slot_policy",
+ hdrs = ["internal/node_slot_policy.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = ["//absl/base:config"],
)
cc_test(
- name = "node_hash_policy_test",
- srcs = ["internal/node_hash_policy_test.cc"],
+ name = "node_slot_policy_test",
+ srcs = ["internal/node_slot_policy_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":hash_policy_traits",
- ":node_hash_policy",
+ ":node_slot_policy",
"@com_google_googletest//:gtest_main",
],
)
diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt
index 78584d2c..bb718cf8 100644
--- a/absl/container/CMakeLists.txt
+++ b/absl/container/CMakeLists.txt
@@ -348,7 +348,7 @@ absl_cc_library(
DEPS
absl::container_memory
absl::hash_function_defaults
- absl::node_hash_policy
+ absl::node_slot_policy
absl::raw_hash_map
absl::algorithm_container
absl::memory
@@ -382,7 +382,7 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
DEPS
absl::hash_function_defaults
- absl::node_hash_policy
+ absl::node_slot_policy
absl::raw_hash_set
absl::algorithm_container
absl::memory
@@ -599,9 +599,9 @@ absl_cc_library(
absl_cc_library(
NAME
- node_hash_policy
+ node_slot_policy
HDRS
- "internal/node_hash_policy.h"
+ "internal/node_slot_policy.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
@@ -611,14 +611,14 @@ absl_cc_library(
absl_cc_test(
NAME
- node_hash_policy_test
+ node_slot_policy_test
SRCS
- "internal/node_hash_policy_test.cc"
+ "internal/node_slot_policy_test.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::hash_policy_traits
- absl::node_hash_policy
+ absl::node_slot_policy
GTest::gmock_main
)
diff --git a/absl/container/internal/node_hash_policy.h b/absl/container/internal/node_slot_policy.h
index 4617162f..baba5743 100644
--- a/absl/container/internal/node_hash_policy.h
+++ b/absl/container/internal/node_slot_policy.h
@@ -30,8 +30,8 @@
// It may also optionally define `value()` and `apply()`. For documentation on
// these, see hash_policy_traits.h.
-#ifndef ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
-#define ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
+#ifndef ABSL_CONTAINER_INTERNAL_NODE_SLOT_POLICY_H_
+#define ABSL_CONTAINER_INTERNAL_NODE_SLOT_POLICY_H_
#include <cassert>
#include <cstddef>
@@ -46,7 +46,7 @@ ABSL_NAMESPACE_BEGIN
namespace container_internal {
template <class Reference, class Policy>
-struct node_hash_policy {
+struct node_slot_policy {
static_assert(std::is_lvalue_reference<Reference>::value, "");
using slot_type = typename std::remove_cv<
@@ -89,4 +89,4 @@ struct node_hash_policy {
ABSL_NAMESPACE_END
} // namespace absl
-#endif // ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
+#endif // ABSL_CONTAINER_INTERNAL_NODE_SLOT_POLICY_H_
diff --git a/absl/container/internal/node_hash_policy_test.cc b/absl/container/internal/node_slot_policy_test.cc
index 84aabba9..51b7467b 100644
--- a/absl/container/internal/node_hash_policy_test.cc
+++ b/absl/container/internal/node_slot_policy_test.cc
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "absl/container/internal/node_hash_policy.h"
+#include "absl/container/internal/node_slot_policy.h"
#include <memory>
@@ -27,7 +27,7 @@ namespace {
using ::testing::Pointee;
-struct Policy : node_hash_policy<int&, Policy> {
+struct Policy : node_slot_policy<int&, Policy> {
using key_type = int;
using init_type = int;
diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h
index 7a39f628..302dafa2 100644
--- a/absl/container/node_hash_map.h
+++ b/absl/container/node_hash_map.h
@@ -43,7 +43,7 @@
#include "absl/algorithm/container.h"
#include "absl/container/internal/container_memory.h"
#include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export
-#include "absl/container/internal/node_hash_policy.h"
+#include "absl/container/internal/node_slot_policy.h"
#include "absl/container/internal/raw_hash_map.h" // IWYU pragma: export
#include "absl/memory/memory.h"
@@ -535,7 +535,7 @@ namespace container_internal {
template <class Key, class Value>
class NodeHashMapPolicy
- : public absl::container_internal::node_hash_policy<
+ : public absl::container_internal::node_slot_policy<
std::pair<const Key, Value>&, NodeHashMapPolicy<Key, Value>> {
using value_type = std::pair<const Key, Value>;
diff --git a/absl/container/node_hash_set.h b/absl/container/node_hash_set.h
index 93b15f46..4247288d 100644
--- a/absl/container/node_hash_set.h
+++ b/absl/container/node_hash_set.h
@@ -39,7 +39,7 @@
#include "absl/algorithm/container.h"
#include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export
-#include "absl/container/internal/node_hash_policy.h"
+#include "absl/container/internal/node_slot_policy.h"
#include "absl/container/internal/raw_hash_set.h" // IWYU pragma: export
#include "absl/memory/memory.h"
@@ -442,7 +442,7 @@ namespace container_internal {
template <class T>
struct NodeHashSetPolicy
- : absl::container_internal::node_hash_policy<T&, NodeHashSetPolicy<T>> {
+ : absl::container_internal::node_slot_policy<T&, NodeHashSetPolicy<T>> {
using key_type = T;
using init_type = T;
using constant_iterators = std::true_type;