Add a new HashSet template

* Intended to replace RBSet in most cases.
* Optimized for iteration speed
This commit is contained in:
reduz 2022-05-19 17:00:06 +02:00
parent 410893ad0f
commit 45af29da80
243 changed files with 1400 additions and 662 deletions

View file

@ -128,12 +128,12 @@ private:
}
template <class T>
static Array to_array(const RBSet<T> &p_inp) {
static Array to_array(const HashSet<T> &p_inp) {
Array ret;
typename RBSet<T>::Element *elem = p_inp.front();
typename HashSet<T>::Iterator elem = p_inp.begin();
while (elem) {
ret.push_back(elem->get());
elem = elem->next();
ret.push_back(*elem);
++elem;
}
return ret;
}
@ -147,7 +147,7 @@ private:
}
template <class T>
static void set_from_array(RBSet<T> &r_out, const Array &p_inp) {
static void set_from_array(HashSet<T> &r_out, const Array &p_inp) {
r_out.clear();
for (int i = 0; i < p_inp.size(); i++) {
r_out.insert(p_inp[i]);