diff options
author | Abseil Team <absl-team@google.com> | 2024-06-03 13:27:55 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-06-03 13:30:08 -0700 |
commit | 65dfbf2b51f0d152b7beb9c93186992d347b37a5 (patch) | |
tree | 7039c25e1d7ca8694661be236c3d91d067e0c8bd /absl/container/internal | |
parent | d06b82773e2306a99a8971934fb5845d5c04a170 (diff) | |
download | abseil-65dfbf2b51f0d152b7beb9c93186992d347b37a5.tar.gz abseil-65dfbf2b51f0d152b7beb9c93186992d347b37a5.tar.bz2 abseil-65dfbf2b51f0d152b7beb9c93186992d347b37a5.zip |
Clarify function comment for `erase` by stating that this idiom only works for "some" standard containers.
If you use this idiom with `std::vector` or `absl::btree_map` you can end up either skipping elements or dereferencing an invalid iterator.
PiperOrigin-RevId: 639892758
Change-Id: Ic5c213667b4b1e8c39813ee237aaffe320a8eb27
Diffstat (limited to 'absl/container/internal')
-rw-r--r-- | absl/container/internal/raw_hash_set.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 1f677a4e..9ef9a6be 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -3105,7 +3105,7 @@ class raw_hash_set { // this method returns void to reduce algorithmic complexity to O(1). The // iterator is invalidated, so any increment should be done before calling // erase. In order to erase while iterating across a map, use the following - // idiom (which also works for standard containers): + // idiom (which also works for some standard containers): // // for (auto it = m.begin(), end = m.end(); it != end;) { // // `erase()` will invalidate `it`, so advance `it` first. |