Skip to content
  • Mark OLESEN's avatar
    ENH: HashTable::emplace_set() method, HashPtrTable support for unique_ptr · 4110699d
    Mark OLESEN authored
    - 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));
    4110699d