diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-11-07 16:51:58 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-11-07 21:58:31 +0000 |
commit | e97179bacd067ccd3ee765632e0c034df152ccb6 (patch) | |
tree | 457ad46fed93b91baa0d31496cbe1d323251232a /libstdc++-v3 | |
parent | 90c578654a2c96032aa6621449859243df5f641b (diff) | |
download | gcc-e97179bacd067ccd3ee765632e0c034df152ccb6.zip gcc-e97179bacd067ccd3ee765632e0c034df152ccb6.tar.gz gcc-e97179bacd067ccd3ee765632e0c034df152ccb6.tar.bz2 |
libstdc++: Improve comment for _Hashtable::_M_insert_unique_node
Clarify the effects if rehashing is needed. Document the __n_elt
parameter.
libstdc++-v3/ChangeLog:
* include/bits/hashtable.h (_M_insert_unique_node): Improve
comment.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/include/bits/hashtable.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index bd514ca..6bcba2d 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -893,9 +893,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pair<__node_ptr, __hash_code> _M_compute_hash_code(__node_ptr __hint, const key_type& __k) const; - // Insert node __n with hash code __code, in bucket __bkt if no - // rehash (assumes no element with same key already present). + // Insert node __n with hash code __code, in bucket __bkt (or another + // bucket if rehashing is needed). + // Assumes no element with equivalent key is already present. // Takes ownership of __n if insertion succeeds, throws otherwise. + // __n_elt is an estimated number of elements we expect to insert, + // used as a hint for rehashing when inserting a range. iterator _M_insert_unique_node(size_type __bkt, __hash_code, __node_ptr __n, size_type __n_elt = 1); |