ENH: HashTable::emplace_set() method, HashPtrTable support for unique_ptr
- forwarding like the emplace() method, but overwriting existing entries as required - propagate similar changes to HashPtrTable For example, with HashPtrTable<labelList> table(...) : With 'insert' semantics table.emplace("list1", 1000); vs if (!table.found("list1")) { table.set("list1", new labelList(1000)); } or table.insert("list1", autoPtr<labelList>::New(1000)); Note that the last example invokes an unnecessary allocation/deletion if the insertion is unsuccessful. With 'set' semantics: table.emplace_set("list1", 15); vs table.set("list1", new labelList(15));
Showing
- applications/test/HashPtrTable/Test-HashPtrTable.C 72 additions, 1 deletionapplications/test/HashPtrTable/Test-HashPtrTable.C
- applications/test/HashTable2/Test-HashTable2.C 4 additions, 2 deletionsapplications/test/HashTable2/Test-HashTable2.C
- src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.H 20 additions, 1 deletion...penFOAM/containers/HashTables/HashPtrTable/HashPtrTable.H
- src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableI.H 58 additions, 1 deletion...enFOAM/containers/HashTables/HashPtrTable/HashPtrTableI.H
- src/OpenFOAM/containers/HashTables/HashTable/HashTable.H 5 additions, 0 deletionssrc/OpenFOAM/containers/HashTables/HashTable/HashTable.H
- src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H 13 additions, 1 deletionsrc/OpenFOAM/containers/HashTables/HashTable/HashTableI.H
Please register or sign in to comment