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

@ -64,8 +64,8 @@ class HashSet
public:
typedef typename HashTable<nil, Key, Hash>::iterator iterator;
typedef typename HashTable<nil, Key, Hash>::const_iterator const_iterator;
using iterator = typename HashTable<nil, Key, Hash>::iterator;
using const_iterator = typename HashTable<nil, Key, Hash>::const_iterator;
// Constructors
@ -154,6 +154,25 @@ public:
return HashTable<nil, Key, Hash>::erase(key);
}
//- Unset the listed keys - same as erase
label unset(const UList<Key>& lst)
{
return HashTable<nil, Key, Hash>::erase(lst);
}
//- Unset the listed keys - same as erase
template<unsigned Size>
label unset(const FixedList<Key, Size>& lst)
{
return HashTable<nil, Key, Hash>::erase(lst);
}
//- Unset the listed keys - same as erase
label unset(std::initializer_list<Key> lst)
{
return HashTable<nil, Key, Hash>::erase(lst);
}
// Member Operators