3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

update core minimization code

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-06-23 21:39:28 -07:00
parent 41edf5f91e
commit c72ed3e6b4
9 changed files with 287 additions and 109 deletions

View file

@ -556,6 +556,38 @@ public:
out << "]";
}
core_hashtable& operator|=(core_hashtable const& other) {
if (this == &other) return *this;
iterator i = begin(), e = end();
for (; i != e; ++i) {
insert(*i);
}
return *this;
}
core_hashtable& operator&=(core_hashtable const& other) {
if (this == &other) return *this;
core_hashtable copy(*this);
iterator i = copy.begin(), e = copy.end();
for (; i != e; ++i) {
if (!other.contains(*i)) {
remove(*i);
}
}
return *this;
}
core_hashtable& operator=(core_hashtable const& other) {
if (this == &other) return *this;
reset();
core_hashtable::iterator i = other.begin(), e = other.end();
for (; i != e; ++i) {
insert(*i);
}
return *this;
}
#ifdef Z3DEBUG
bool check_invariant() {
entry * curr = m_table;
@ -582,9 +614,6 @@ public:
unsigned long long get_num_collision() const { return 0; }
#endif
private:
core_hashtable& operator=(core_hashtable const&);
};
@ -640,4 +669,5 @@ public:
core_hashtable<int_hash_entry<INT_MIN, INT_MIN + 1>, HashProc, EqProc>(initial_capacity, h, e) {}
};
#endif /* HASHTABLE_H_ */

View file

@ -51,6 +51,7 @@ class obj_hashtable : public core_hashtable<obj_hash_entry<T>, obj_ptr_hash<T>,
public:
obj_hashtable(unsigned initial_capacity = DEFAULT_HASHTABLE_INITIAL_CAPACITY):
core_hashtable<obj_hash_entry<T>, obj_ptr_hash<T>, ptr_eq<T> >(initial_capacity) {}
};
template<typename Key, typename Value>