Skip to content

Commit c2d94e2

Browse files
authored
Merge pull request #11123 from Ivorforce/ahashmap-default
Update descriptions of `AHashMap` and `HashMap`. Recommend `AHashMap` over `HashMap` by default.
2 parents 471ad88 + bc71be5 commit c2d94e2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

contributing/development/core_and_modules/core_types.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ scripting API.
149149
+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
150150
| |hash_set| | ``std::unordered_set`` | **Use this as the "default" set type.** |
151151
+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
152-
| |hash_map| | ``std::unordered_map`` | **Use this as the "default" map type.** Preserves insertion order. |
152+
| |a_hash_map| | ``std::unordered_map`` | **Use this as the "default" map type.** Does not preserve insertion order. |
153+
| | | Note that pointers into the map, as well as iterators, are not stable under mutations.|
154+
| | | If either of these affordances are needed, use ``HashMap`` instead. |
153155
+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
154156
| |string_name| 📜 | ``std::string`` | Uses string interning for fast comparisons. Use this for static strings that are |
155157
| | | referenced frequently and used in multiple locations in the engine. |
@@ -186,7 +188,10 @@ scripting API.
186188
| | | This means it's generally slower but can be copied around almost for free. |
187189
| | | The performance benefits of ``VSet`` aren't established, so prefer using other types. |
188190
+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
189-
| |a_hash_map| | ``std::unordered_map`` | Array-based implementation of a hash map. Does not preserve insertion order. |
191+
| |hash_map| | ``std::unordered_map`` | Defensive (robust but slow) map type. Preserves insertion order. |
192+
| | | Pointers to keys and values, as well as iterators, are stable under mutation. |
193+
| | | Use this map type when either of these affordances are needed. Use ``AHashMap`` |
194+
| | | otherwise. |
190195
+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
191196
| |rb_map| | ``std::map`` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black-tree>`__ |
192197
| | | for faster access. |

0 commit comments

Comments
 (0)