Skip to content
Snippets Groups Projects
Commit 85f11fa7 authored by Andrew Heather's avatar Andrew Heather
Browse files

added sortedToc()

parent df37b6b4
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,7 @@ int main() ...@@ -56,6 +56,7 @@ int main()
table1.erase("abs"); table1.erase("abs");
Info<< "\ntable1 toc: " << table1.toc() << endl; Info<< "\ntable1 toc: " << table1.toc() << endl;
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
table1.printInfo(Info) table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl; << "table1 [" << table1.size() << "] " << endl;
forAllIter(HASHTABLE_CLASS<double>, table1, iter) forAllIter(HASHTABLE_CLASS<double>, table1, iter)
......
...@@ -231,7 +231,6 @@ Foam::HashTable<T, Key, Hash>::find ...@@ -231,7 +231,6 @@ Foam::HashTable<T, Key, Hash>::find
} }
// Return the table of contents
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::List<Key> Foam::HashTable<T, Key, Hash>::toc() const Foam::List<Key> Foam::HashTable<T, Key, Hash>::toc() const
{ {
...@@ -247,6 +246,16 @@ 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> template<class T, class Key, class Hash>
bool Foam::HashTable<T, Key, Hash>::set bool Foam::HashTable<T, Key, Hash>::set
( (
......
...@@ -198,6 +198,9 @@ public: ...@@ -198,6 +198,9 @@ public:
//- Return the table of contents //- Return the table of contents
List<Key> toc() const; List<Key> toc() const;
//- Return the table of contents as a sorted list
List<Key> sortedToc() const;
//- Print information //- Print information
Ostream& printInfo(Ostream&) const; Ostream& printInfo(Ostream&) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment