mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +00:00
adding hash/eq to uint_set
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
1239c8f8e8
commit
0997eba700
2 changed files with 39 additions and 0 deletions
|
@ -218,6 +218,18 @@ public:
|
|||
|
||||
iterator const begin() const { return iterator(*this, false); }
|
||||
iterator const end() const { return iterator(*this, true); }
|
||||
|
||||
unsigned get_hash() const {
|
||||
unsigned h = 0;
|
||||
for (unsigned i = 0; i < size(); ++i) {
|
||||
h += (i+1)*((*this)[i]);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
struct eq { bool operator()(uint_set const& s1, uint_set const& s2) const { return s1 == s2; } };
|
||||
struct hash { unsigned operator()(uint_set const& s) const { return s.get_hash(); } };
|
||||
|
||||
};
|
||||
|
||||
inline std::ostream & operator<<(std::ostream & target, const uint_set & s) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue