3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-27 10:58:48 +00:00

Remove a few unneeded constructors (#9879)

This commit is contained in:
Nuno Lopes 2026-06-16 14:55:59 +01:00 committed by GitHub
parent 86de0cbd71
commit ff2e0a3ab0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 42 deletions

View file

@ -62,10 +62,6 @@ public:
struct key_data { struct key_data {
Key * m_key = nullptr; Key * m_key = nullptr;
Value m_value; Value m_value;
key_data() = default;
key_data(Key* k): m_key(k) {}
key_data(Key* k, Value const& v): m_key(k), m_value(v) {}
key_data(Key* k, Value&& v): m_key(k), m_value(std::move(v)) {}
Value const & get_value() const { return m_value; } Value const & get_value() const { return m_value; }
Key & get_key () const { return *m_key; } Key & get_key () const { return *m_key; }
unsigned hash() const { return m_key->hash(); } unsigned hash() const { return m_key->hash(); }
@ -136,15 +132,15 @@ public:
} }
void insert(Key * const k, Value const & v) { void insert(Key * const k, Value const & v) {
m_table.insert(key_data(k, v)); m_table.insert(key_data{k, v});
} }
void insert(Key * const k, Value && v) { void insert(Key * const k, Value && v) {
m_table.insert(key_data(k, std::move(v))); m_table.insert(key_data{k, std::move(v)});
} }
Value& insert_if_not_there(Key * k, Value const & v) { Value& insert_if_not_there(Key * k, Value const & v) {
return m_table.insert_if_not_there2(key_data(k, v))->get_data().m_value; return m_table.insert_if_not_there2(key_data{k, v})->get_data().m_value;
} }
Value& insert_if_not_there(Key * k, Value && v) { Value& insert_if_not_there(Key * k, Value && v) {
@ -194,7 +190,7 @@ public:
} }
iterator find_iterator(Key * k) const { iterator find_iterator(Key * k) const {
return m_table.find(key_data(k)); return m_table.find(key_data{k});
} }
bool contains(Key * k) const { bool contains(Key * k) const {
@ -202,7 +198,7 @@ public:
} }
void remove(Key * k) { void remove(Key * k) {
m_table.remove(key_data(k)); m_table.remove(key_data{k});
} }
void erase(Key * k) { void erase(Key * k) {
@ -213,7 +209,7 @@ public:
void get_collisions(Key * k, vector<Key*>& collisions) { void get_collisions(Key * k, vector<Key*>& collisions) {
vector<key_data> cs; vector<key_data> cs;
m_table.get_collisions(key_data(k), cs); m_table.get_collisions(key_data{k}, cs);
for (key_data const& kd : cs) { for (key_data const& kd : cs) {
collisions.push_back(kd.m_key); collisions.push_back(kd.m_key);
} }

View file

@ -59,17 +59,13 @@ protected:
class entry; class entry;
public: public:
class key_data { class key_data {
Key1 * m_key1; Key1 * m_key1 = nullptr;
Key2 * m_key2; Key2 * m_key2 = nullptr;
Value m_value; Value m_value;
unsigned m_hash; unsigned m_hash = 0;
friend class entry; friend class entry;
public: public:
key_data(): key_data() = default;
m_key1(nullptr),
m_key2(nullptr),
m_hash(0) {
}
key_data(Key1 * k1, Key2 * k2): key_data(Key1 * k1, Key2 * k2):
m_key1(k1), m_key1(k1),
m_key2(k2) { m_key2(k2) {

View file

@ -60,19 +60,14 @@ protected:
class entry; class entry;
public: public:
class key_data { class key_data {
Key1 * m_key1; Key1 * m_key1 = nullptr;
Key2 * m_key2; Key2 * m_key2 = nullptr;
Key3 * m_key3; Key3 * m_key3 = nullptr;
Value m_value; Value m_value;
unsigned m_hash; unsigned m_hash = 0;
friend class entry; friend class entry;
public: public:
key_data(): key_data() = default;
m_key1(nullptr),
m_key2(nullptr),
m_key3(nullptr),
m_hash(0) {
}
key_data(Key1 * k1, Key2 * k2, Key3 * k3): key_data(Key1 * k1, Key2 * k2, Key3 * k3):
m_key1(k1), m_key1(k1),
m_key2(k2), m_key2(k2),

View file

@ -30,17 +30,6 @@ class symbol_table {
struct key_data { struct key_data {
symbol m_key; symbol m_key;
T m_data; T m_data;
key_data() = default;
explicit key_data(symbol k):
m_key(k) {
}
key_data(symbol k, const T & d):
m_key(k),
m_data(d) {
}
}; };
struct key_data_hash_proc { struct key_data_hash_proc {
@ -129,7 +118,7 @@ public:
} }
bool contains(symbol key) const { bool contains(symbol key) const {
return m_sym_table.contains(key_data(key)); return m_sym_table.contains(key_data{key});
} }
unsigned get_scope_level() const { unsigned get_scope_level() const {
@ -148,11 +137,11 @@ public:
m_trail_stack.push_back(dummy); m_trail_stack.push_back(dummy);
key_data & new_entry = m_trail_stack.back(); key_data & new_entry = m_trail_stack.back();
new_entry.m_key = symbol::mark(new_entry.m_key); new_entry.m_key = symbol::mark(new_entry.m_key);
m_sym_table.insert(key_data(key, data)); m_sym_table.insert(key_data{key, data});
} }
} }
else { else {
m_sym_table.insert(key_data(key, data)); m_sym_table.insert(key_data{key, data});
} }
} }