]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Improve comment for _Hashtable::_M_insert_unique_node
authorJonathan Wakely <jwakely@redhat.com>
Thu, 7 Nov 2024 16:51:58 +0000 (16:51 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 7 Nov 2024 21:58:31 +0000 (21:58 +0000)
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.

libstdc++-v3/include/bits/hashtable.h

index bd514cab798d29a92fa4fe111f8226ad32fcab3c..6bcba2de368e504be5177e64be1be8666ebf06ed 100644 (file)
@@ -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);