Commit 85f11fa7 authored by Andrew Heather's avatar Andrew Heather
Browse files

added sortedToc()

parent df37b6b4
......@@ -56,6 +56,7 @@ int main()
table1.erase("abs");
Info<< "\ntable1 toc: " << table1.toc() << endl;
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl;
forAllIter(HASHTABLE_CLASS<double>, table1, iter)
......
......@@ -231,7 +231,6 @@ Foam::HashTable<T, Key, Hash>::find
}
// Return the table of contents
template<class T, class Key, class Hash>
Foam::List<Key> Foam::HashTable<T, Key, Hash>::toc() const
{
......@@ -247,6 +246,16 @@ Foam::List<Key> Foam::HashTable<T, Key, Hash>::toc() const
}
template<class T, class Key, class Hash>
Foam::List<Key> Foam::HashTable<T, Key, Hash>::sortedToc() const
{
List<Key> sortedList = this->toc();
sort(sortedList);
return sortedList;
}
template<class T, class Key, class Hash>
bool Foam::HashTable<T, Key, Hash>::set
(
......
......@@ -198,6 +198,9 @@ public:
//- Return the table of contents
List<Key> toc() const;
//- Return the table of contents as a sorted list
List<Key> sortedToc() const;
//- Print information
Ostream& printInfo(Ostream&) const;
......
Markdown is supported
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