mirror of
https://github.com/Z3Prover/z3
synced 2025-10-01 21:49:29 +00:00
remove a few useless dynamic casts
This commit is contained in:
parent
f0c788581a
commit
c350ddf990
8 changed files with 18 additions and 28 deletions
|
@ -57,19 +57,7 @@ class obj_map {
|
|||
public:
|
||||
struct key_data {
|
||||
Key * m_key = nullptr;
|
||||
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 m_value;
|
||||
Value const & get_value() const { return m_value; }
|
||||
Key & get_key () const { return *m_key; }
|
||||
unsigned hash() const { return m_key->hash(); }
|
||||
|
@ -97,8 +85,8 @@ public:
|
|||
table m_table;
|
||||
|
||||
public:
|
||||
obj_map():
|
||||
m_table(DEFAULT_HASHTABLE_INITIAL_CAPACITY) {}
|
||||
obj_map(unsigned initial_capacity = DEFAULT_HASHTABLE_INITIAL_CAPACITY):
|
||||
m_table(initial_capacity) {}
|
||||
|
||||
typedef typename table::iterator iterator;
|
||||
typedef typename table::data data;
|
||||
|
@ -146,6 +134,10 @@ public:
|
|||
return m_table.insert_if_not_there2(key_data(k, v))->get_data().m_value;
|
||||
}
|
||||
|
||||
bool insert_if_not_there_core(Key * k, Value const & v, obj_map_entry * & et) {
|
||||
return m_table.insert_if_not_there_core({k, v}, et);
|
||||
}
|
||||
|
||||
obj_map_entry * insert_if_not_there3(Key * k, Value const & v) {
|
||||
return m_table.insert_if_not_there2(key_data(k, v));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue