mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
HashTbl changes
- iterators store pointers instead of references to the HashTbl.
This lets us use the default bitwise copy/assignment
- add empty constructor for iterators. It returns the equivalent to end().
This lets us do this:
HashTbl<label>::iterator iter;
// some time later
iter = find(Value);
- erase(const HashTbl<AnyType, Key, AnyHash>&) is now more generous.
Only the Key type matters, not the hashing function.
This commit is contained in:
@ -40,6 +40,7 @@ using namespace Foam;
|
||||
int main()
|
||||
{
|
||||
HASHTABLE_CLASS<double> table1(13);
|
||||
HASHTABLE_CLASS<double>::iterator iter;
|
||||
|
||||
table1.insert("aaa", 1.0);
|
||||
table1.insert("aba", 2.0);
|
||||
@ -52,8 +53,12 @@ int main()
|
||||
table1.insert("adx", 9.0);
|
||||
table1.insert("aec", 10.0);
|
||||
|
||||
// erase by key
|
||||
table1.erase("aaw");
|
||||
table1.erase("abs");
|
||||
|
||||
// erase by iterator
|
||||
iter = table1.find("abs");
|
||||
table1.erase(iter);
|
||||
|
||||
Info<< "\ntable1 toc: " << table1.toc() << endl;
|
||||
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
|
||||
|
||||
Reference in New Issue
Block a user