Skip to content
  • Mark OLESEN's avatar
    ENH: HashTable sizing improvements · 89d36872
    Mark OLESEN authored and Andrew Heather's avatar Andrew Heather committed
    - earlier deletion of unpopulated HashTable on resizing:
    
      If the table is already clear (ie, has no entries),
      can immediately remove the old internal table before reallocating
      the newly sized table, which may avoid a needless memory spike.
    
    - reserve() method:
    
      Naming and general behaviour as per std::unordered_map.
      It behaves similarly to the resize() method but is supplied the
      number of elements instead of the capacity, which can be a more
      natural way of specifying the storage requirements.
      Additionally, reserve() will only increase the table capacity for
      behaviour similar to DynamicList and std::vector, std::string etc.
    
      Old:
         labelHashSet set;
         set.resize(2*nElems);
    
      Now:
         labelHashSet set;
         set.reserve(nElems);
    
    - remove unused HashTable(Istream&, label) constructor
    
    STYLE: static_cast of (nullptr) and std::fill_n for filling table
    89d36872