Skip to content
Snippets Groups Projects
Unverified Commit ccb6e08a authored by François Dumont's avatar François Dumont
Browse files

libstdc++: [_Hashtable] Fix some implementation inconsistencies


Get rid of the different usages of the mutable keyword except in
_Prime_rehash_policy where it is preserved for abi compatibility reason.

Fix comment to explain that we need the computation of bucket index noexcept
to be able to rehash the container when needed.

For Standard instantiations through std::unordered_xxx containers we already
force caching of hash code when hash functor is not noexcep so it is guarantied.

The static_assert purpose in _Hashtable on _M_bucket_index is thus limited
to usages of _Hashtable with exotic _Hashtable_traits.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (_NodeBuilder<>::_S_build): Remove
	const qualification on _NodeGenerator instance.
	(_ReuseOrAllocNode<>::operator()(_Args&&...)): Remove const qualification.
	(_ReuseOrAllocNode<>::_M_nodes): Remove mutable.
	(_Insert_base<>::_M_insert_range): Remove _NodeGetter const qualification.
	(_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)):
	Simplify noexcept declaration, we already static_assert that _RangeHash functor
	is noexcept.
	* include/bits/hashtable.h: Rework comments. Remove const qualifier on
	_NodeGenerator& arguments.

Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
parent caef7002
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment