diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-24 12:50:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 12:50:48 +0200 |
commit | 31ca1f5aa1f7985d4d8daec22b44e73eacccc0b3 (patch) | |
tree | 8ed88afbcc3a6624aefe71990736da274979008f | |
parent | 0d9f87b37ead37b24640be4d661ebcb2cfc62045 (diff) | |
parent | ce352ce5b4f0e4718ba3ecd1b12d59854b617182 (diff) |
Merge pull request #33012 from madmiraal/vmap-array-operator
Initialise VMap and HashMap values to the default when they are created.
-rw-r--r-- | core/hash_map.h | 1 | ||||
-rw-r--r-- | core/vmap.h | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/hash_map.h b/core/hash_map.h index 38da1d59ab..edc67e7806 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -210,6 +210,7 @@ private: e->next = hash_table[index]; e->hash = hash; e->pair.key = p_key; + e->pair.data = TData(); hash_table[index] = e; elements++; diff --git a/core/vmap.h b/core/vmap.h index fde9723d71..ed66b46993 100644 --- a/core/vmap.h +++ b/core/vmap.h @@ -196,8 +196,7 @@ public: int pos = _find_exact(p_key); if (pos < 0) { - V val; - pos = insert(p_key, val); + pos = insert(p_key, V()); } return _cowdata.get_m(pos).value; |