ENH: support HashTable erasure via a FixedList

- propagate common erasure methods as HashSet::unset() method,
  for symmetry with HashSet::set()
This commit is contained in:
Mark Olesen
2017-04-29 14:50:46 +02:00
parent ded105c539
commit a2ddf7dd48
3 changed files with 96 additions and 18 deletions

View File

@ -60,6 +60,7 @@ namespace Foam
template<class T> class List;
template<class T> class UList;
template<class T, unsigned Size> class FixedList;
template<class T, class Key, class Hash> class HashTable;
template<class T, class Key, class Hash> class HashPtrTable;
@ -174,6 +175,18 @@ class HashTable
bool set(const Key& key, const T& newEntry, const bool protect);
protected:
// Protected Member Functions
//- Remove using begin/end iterators of listed keys
template<class InputIter>
inline label eraseMultiple
(
const InputIter begIter,
const InputIter endIter
);
public:
// Forward declaration of iterators
@ -274,6 +287,15 @@ public:
// Return the number of elements removed
label erase(const UList<Key>& keys);
//- Remove entries given by the listed keys from this HashTable
// Return the number of elements removed
template<unsigned Size>
label erase(const FixedList<Key, Size>& keys);
//- Remove entries given by the listed keys from this HashTable
// Return the number of elements removed
label erase(std::initializer_list<Key> keys);
//- Remove entries given by the given keys from this HashTable
// Return the number of elements removed.
// The parameter HashTable needs the same type of key, but the