HashTable::erase from list of keys or the keys from another HashTable

- the parameter HashTable can hold arbitrary data .. just the type of keys
  needs to match
This commit is contained in:
Mark Olesen
2009-01-11 20:01:53 +01:00
parent a53b47355a
commit c2ac216eaf
7 changed files with 88 additions and 52 deletions

View File

@ -51,20 +51,15 @@ namespace Foam
// Forward declaration of friend functions and operators
template<class T> class List;
template<class T> class UList;
template<class T, class Key, class Hash> class HashTable;
template<class T, class Key, class Hash> class HashPtrTable;
template<class T, class Key, class Hash> Istream& operator>>
(
Istream&,
HashTable<T, Key, Hash>&
);
template<class T, class Key, class Hash>
Istream& operator>>(Istream&, HashTable<T, Key, Hash>&);
template<class T, class Key, class Hash> Ostream& operator<<
(
Ostream&,
const HashTable<T, Key, Hash>&
);
template<class T, class Key, class Hash>
Ostream& operator<<(Ostream&, const HashTable<T, Key, Hash>&);
/*---------------------------------------------------------------------------*\
@ -203,9 +198,16 @@ public:
//- Erase an hashedEntry specified by given key if in table
bool erase(const Key&);
//- Remove entries in the given HashTable from this HashTable
//- Remove entries given by the listed keys from this HashTable
// Return the number of elements removed
label erase(const HashTable<T, Key, Hash>&);
label erase(const UList<Key>&);
//- Remove entries given by the given keys from this HashTable
// Return the number of elements removed.
// The parameter HashTable needs the same type of keys, but
// but the type of values held is arbitrary.
template<class AnyType>
label erase(const HashTable<AnyType, Key, Hash>&);
//- Resize the hash table for efficiency
void resize(const label newSize);