ENH: replace DictionaryBase toc with sortedToc version (#1467)

- cannot rely on the entries having a keyword method

STYLE: apply consistent hash table sizing for debug objects
This commit is contained in:
Mark Olesen
2019-10-24 17:54:45 +02:00
committed by Andrew Heather
parent 9f11d892f5
commit 5213a4aa9d
6 changed files with 35 additions and 48 deletions

View File

@ -158,15 +158,10 @@ T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
template<class IDLListType, class T>
Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
{
wordList keywords(this->size());
label i = 0;
for (auto iter = this->cbegin(); iter != this->cend(); ++iter)
{
keywords[i++] = iter().keyword();
}
return keywords;
// Cannot rely on the items themselves having a keyword() method
// so simply return the toc() from the hashed entries
// Make it sorted, since anything else would have no meaning.
return hashedTs_.sortedToc();
}