From e181410198b58b8dffe6e62e24ad56e5d78e2790 Mon Sep 17 00:00:00 2001 From: Evan Brown Date: Thu, 20 Jun 2024 09:10:33 -0700 Subject: Document that swisstable and b-tree containers are not exception-safe. For performance reasons, these containers are optimized for the case in which allocations/deallocations/comparisons/hashers can't throw exceptions. PiperOrigin-RevId: 645054627 Change-Id: I99be651b26f5bbb87da6ef246b92b20a375224d7 --- absl/container/btree_map.h | 2 ++ absl/container/btree_set.h | 2 ++ absl/container/flat_hash_map.h | 2 ++ absl/container/flat_hash_set.h | 3 +++ absl/container/node_hash_map.h | 2 ++ absl/container/node_hash_set.h | 2 ++ 6 files changed, 13 insertions(+) (limited to 'absl') diff --git a/absl/container/btree_map.h b/absl/container/btree_map.h index 3515838b..b959b674 100644 --- a/absl/container/btree_map.h +++ b/absl/container/btree_map.h @@ -49,6 +49,8 @@ // // Another API difference is that btree iterators can be subtracted, and this // is faster than using std::distance. +// +// B-tree maps are not exception-safe. #ifndef ABSL_CONTAINER_BTREE_MAP_H_ #define ABSL_CONTAINER_BTREE_MAP_H_ diff --git a/absl/container/btree_set.h b/absl/container/btree_set.h index 6e123ce4..986d27da 100644 --- a/absl/container/btree_set.h +++ b/absl/container/btree_set.h @@ -48,6 +48,8 @@ // // Another API difference is that btree iterators can be subtracted, and this // is faster than using std::distance. +// +// B-tree sets are not exception-safe. #ifndef ABSL_CONTAINER_BTREE_SET_H_ #define ABSL_CONTAINER_BTREE_SET_H_ diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h index 1c43e92d..3eae404f 100644 --- a/absl/container/flat_hash_map.h +++ b/absl/container/flat_hash_map.h @@ -26,6 +26,8 @@ // // In most cases, your default choice for a hash map should be a map of type // `flat_hash_map`. +// +// `flat_hash_map` is not exception-safe. #ifndef ABSL_CONTAINER_FLAT_HASH_MAP_H_ #define ABSL_CONTAINER_FLAT_HASH_MAP_H_ diff --git a/absl/container/flat_hash_set.h b/absl/container/flat_hash_set.h index 7b9e0060..e284a7df 100644 --- a/absl/container/flat_hash_set.h +++ b/absl/container/flat_hash_set.h @@ -26,6 +26,9 @@ // // In most cases, your default choice for a hash set should be a set of type // `flat_hash_set`. +// +// `flat_hash_set` is not exception-safe. + #ifndef ABSL_CONTAINER_FLAT_HASH_SET_H_ #define ABSL_CONTAINER_FLAT_HASH_SET_H_ diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h index 4bba130d..7b74b4b3 100644 --- a/absl/container/node_hash_map.h +++ b/absl/container/node_hash_map.h @@ -32,6 +32,8 @@ // migration, because it guarantees pointer stability. Consider migrating to // `node_hash_map` and perhaps converting to a more efficient `flat_hash_map` // upon further review. +// +// `node_hash_map` is not exception-safe. #ifndef ABSL_CONTAINER_NODE_HASH_MAP_H_ #define ABSL_CONTAINER_NODE_HASH_MAP_H_ diff --git a/absl/container/node_hash_set.h b/absl/container/node_hash_set.h index 82e4923e..7228d192 100644 --- a/absl/container/node_hash_set.h +++ b/absl/container/node_hash_set.h @@ -31,6 +31,8 @@ // `node_hash_set` should be an easy migration. Consider migrating to // `node_hash_set` and perhaps converting to a more efficient `flat_hash_set` // upon further review. +// +// `node_hash_set` is not exception-safe. #ifndef ABSL_CONTAINER_NODE_HASH_SET_H_ #define ABSL_CONTAINER_NODE_HASH_SET_H_ -- cgit v1.2.3