mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: HashTable and HashSet improvements
- unfriend HashSet, HashTable IO operators
- global min(), max(), minMax() functions taking a labelHashSet and an
optional limit. For example,
labelHashSet set = ...;
Info<< "min is " << min(set) << nl;
Info<< "max (non-negative) " << max(set, 0) << nl;
- make HashTable iterator '->' dereferencing more consistent by also
supporting non-pointer types as well.
- read HashTable values in-situ to avoid copying
This commit is contained in:
@ -261,14 +261,24 @@ int main(int argc, char *argv[])
|
||||
|
||||
labelList list1(identity(4, -4));
|
||||
|
||||
Info<<"move insert " << list1 << nl;
|
||||
Info<< "move insert " << list1 << nl;
|
||||
|
||||
ltable1.insert("pqr", std::move(list1));
|
||||
|
||||
Info<<"after insert " << list1 << nl;
|
||||
Info<< "after insert " << list1 << nl;
|
||||
|
||||
Info<< nl << "HashTable<labelList>: "
|
||||
<< ltable1 << nl;
|
||||
|
||||
|
||||
// Use '->' dereferencing
|
||||
const auto iter = ltable1.cfind("ghi");
|
||||
|
||||
if (iter)
|
||||
{
|
||||
Info<< "got with " << iter->size() << nl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
Reference in New Issue
Block a user