Commit 1dc32368 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

BUG: fixed odd sizing for hash tables (fixes #460)

parent f8c58bdd
......@@ -120,7 +120,7 @@ Foam::HashSet<Key, Hash>::HashSet
const HashTable<AnyType, Key, AnyHash>& tbl
)
:
HashTable<nil, Key, Hash>(tbl.size())
HashTable<nil, Key, Hash>(tbl.capacity())
{
using other_iter =
typename HashTable<AnyType, Key, AnyHash>::const_iterator;
......@@ -159,7 +159,7 @@ Foam::label Foam::HashSet<Key, Hash>::insert(std::initializer_list<Key> lst)
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator=(const UList<Key>& lst)
{
assignMultiple(lst.begin(), lst.end(), lst.size());
assignMultiple(lst.begin(), lst.end(), 2*lst.size());
}
......@@ -167,14 +167,14 @@ template<class Key, class Hash>
template<unsigned Size>
void Foam::HashSet<Key, Hash>::operator=(const FixedList<Key, Size>& lst)
{
assignMultiple(lst.begin(), lst.end(), lst.size());
assignMultiple(lst.begin(), lst.end(), 2*lst.size());
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator=(std::initializer_list<Key> lst)
{
assignMultiple(lst.begin(), lst.end(), lst.size());
assignMultiple(lst.begin(), lst.end(), 2*lst.size());
}
......
......@@ -115,7 +115,7 @@ Foam::HashTable<T, Key, Hash>::HashTable
std::initializer_list<Tuple2<Key, T>> lst
)
:
HashTable<T, Key, Hash>(lst.size())
HashTable<T, Key, Hash>(2*lst.size())
{
for (const Tuple2<Key, T>& pair : lst)
{
......@@ -638,7 +638,7 @@ void Foam::HashTable<T, Key, Hash>::operator=
// Could be zero-sized from a previous transfer()
if (!tableSize_)
{
resize(lst.size());
resize(2*lst.size());
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment