Skip to content

Commit

Permalink
libstdc++: Improve comment for _Hashtable::_M_insert_unique_node
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwakely committed Nov 7, 2024
1 parent 90c5786 commit e97179b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libstdc++-v3/include/bits/hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e97179b

Please sign in to comment.