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:
Mark Olesen
2019-07-12 18:00:00 +02:00
parent 05739d6a43
commit 4ee65d12c4
6 changed files with 107 additions and 88 deletions

View File

@ -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;