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:
@ -32,6 +32,7 @@ Description
|
||||
#include "HashOps.H"
|
||||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
#include "MinMax.H"
|
||||
#include "labelPairHashes.H"
|
||||
#include "FlatOutput.H"
|
||||
|
||||
@ -184,6 +185,9 @@ int main(int argc, char *argv[])
|
||||
1, 11, 42
|
||||
};
|
||||
|
||||
Info<<"Set with min/max:" << minMax(setB)
|
||||
<< " min:" << min(setB) << " max:" << max(setB) << nl;
|
||||
|
||||
setB = FixedList<label, 4>({1, 2, 3, 4});
|
||||
setB = {1, 2, 4};
|
||||
setB = List<label>({1, 2, 4});
|
||||
|
||||
Reference in New Issue
Block a user