ENH: additional HashTable emplace/insert/set methods (#1286)

- support move insert/set and emplace insertion.

  These adjustments can be used for improved memory efficiency, and
  allow hash tables of non-copyable objects (eg, std::unique_ptr).

- extend special HashTable output treatment to include pointer-like
  objects such as autoPtr and unique_ptr.

ENH: HashTable::at() method with checking. Fatal if entry does not exist.
This commit is contained in:
Mark Olesen
2019-05-06 08:34:39 +02:00
committed by Andrew Heather
parent e30dc962b3
commit ac317699d8
11 changed files with 227 additions and 70 deletions

View File

@ -249,6 +249,28 @@ int main(int argc, char *argv[])
Info<< nl << "Ending scope" << nl;
}
{
Info<< nl << "Table<labelList> copy/move/emplace insertion" << nl;
HashTable<labelList> ltable1(0);
ltable1.insert("abc", identity(2));
ltable1.insert("def", identity(3));
ltable1.insert("ghi", identity(4));
ltable1.emplace("jkl", 10, -35);
ltable1.emplace("mno");
labelList list1(identity(4, -4));
Info<<"move insert " << list1 << nl;
ltable1.insert("pqr", std::move(list1));
Info<<"after insert " << list1 << nl;
Info<< nl << "HashTable<labelList>: "
<< ltable1 << nl;
}
Info<< "\nEnd\n" << endl;
return 0;