From 1a03fb9dd1c533e42b6d7d1ebea85b448a07e793 Mon Sep 17 00:00:00 2001 From: Evan Brown Date: Thu, 2 Nov 2023 11:21:24 -0700 Subject: [PATCH] Update comments to make it explicit that moving a flat_hash_{set,map} can cause pointers to elements to be invalidated. PiperOrigin-RevId: 578920671 Change-Id: Ica40db48d5565b606e5e5f501c1305612b193d4d --- absl/container/flat_hash_map.h | 2 +- absl/container/flat_hash_set.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h index 8f4d993911d..5304477d276 100644 --- a/absl/container/flat_hash_map.h +++ b/absl/container/flat_hash_map.h @@ -64,7 +64,7 @@ struct FlatHashMapPolicy; // `insert()`, provided that the map is provided a compatible heterogeneous // hashing function and equality operator. // * Invalidates any references and pointers to elements within the table after -// `rehash()`. +// `rehash()` and when the table is moved. // * Contains a `capacity()` member function indicating the number of element // slots (open, deleted, and empty) within the hash map. // * Returns `void` from the `erase(iterator)` overload. diff --git a/absl/container/flat_hash_set.h b/absl/container/flat_hash_set.h index c789c7ef542..a94a82a0bf6 100644 --- a/absl/container/flat_hash_set.h +++ b/absl/container/flat_hash_set.h @@ -60,7 +60,7 @@ struct FlatHashSetPolicy; // that the set is provided a compatible heterogeneous hashing function and // equality operator. // * Invalidates any references and pointers to elements within the table after -// `rehash()`. +// `rehash()` and when the table is moved. // * Contains a `capacity()` member function indicating the number of element // slots (open, deleted, and empty) within the hash set. // * Returns `void` from the `erase(iterator)` overload.