@@ -142,7 +142,7 @@ scripting API.
142142| Godot datatype | Closest C++ STL datatype | Comment |
143143+=======================+==========================+=======================================================================================+
144144| |string | 📜 | ``std::string `` | **Use this as the "default" string type. ** ``String `` uses UTF-32 encoding |
145- | | | to improve performance thanks to its fixed character size. |
145+ | | | to simplify processing thanks to its fixed character size. |
146146+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
147147| |vector | | ``std::vector `` | **Use this as the "default" vector type. ** Uses copy-on-write (COW) semantics. |
148148| | | This means it's generally slower but can be copied around almost for free. |
@@ -180,8 +180,10 @@ scripting API.
180180| | | no heap allocations. |
181181+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
182182| |span | | ``std::span `` | Represents read-only access to a contiguous array without needing to copy any data. |
183- | | | See `pull request description <https://github.com/godotengine/godot/pull/100293 >`__ |
184- | | | for details. |
183+ | | | Note that ``Span `` is designed to be a high performance API: It does not perform |
184+ | | | parameter correctness checks in the same way you might be used to with other Godot |
185+ | | | containers. Use with care. |
186+ | | | `Span ` can be constructed from most array-like containers (e.g. ``vector.span() ``). |
185187+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
186188| |rb_set | | ``std::set `` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black_tree >`__ |
187189| | | for faster access. |
@@ -195,16 +197,18 @@ scripting API.
195197| | | Use this map type when either of these affordances are needed. Use ``AHashMap `` |
196198| | | otherwise. |
197199+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
198- | |rb_map | | ``std::map `` | Uses a `red-black tree <https://en.wikipedia.org/wiki/Red-black-tree >`__ |
199- | | | for faster access. |
200+ | |rb_map | | ``std::map `` | Map type that uses a |
201+ | | | `red-black tree <https://en.wikipedia.org/wiki/Red-black-tree >`__ to find keys. |
202+ | | | The performance benefits of ``RBMap`` aren't established, so prefer using other types.|
200203+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
201204| |dictionary | 📜 | ``std::unordered_map `` | Keys and values can be of any Variant type. No static typing is imposed. |
202205| | | Uses shared reference counting, similar to ``std::shared_ptr ``. |
203206| | | Preserves insertion order. Uses ``HashMap<Variant> `` internally. |
204207+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
205208| |typed_dictionary | 📜 | ``std::unordered_map `` | Subclass of ``Dictionary `` but with static typing for its keys and values. |
206209+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
207- | |pair | | ``std::pair `` | Stores a single key-value pair. |
210+ | |pair | | ``std::pair `` | Stores a single pair. See also ``KeyValue `` in the same file, which uses read-only |
211+ | | | keys. |
208212+-----------------------+--------------------------+---------------------------------------------------------------------------------------+
209213
210214.. |string | replace :: `String <https://github.com/godotengine/godot/blob/master/core/string/ustring.h >`__
@@ -214,8 +218,8 @@ scripting API.
214218.. |string_name | replace :: `StringName <https://github.com/godotengine/godot/blob/master/core/string/string_name.h >`__
215219.. |local_vector | replace :: `LocalVector <https://github.com/godotengine/godot/blob/master/core/templates/local_vector.h >`__
216220.. |array | replace :: `Array <https://github.com/godotengine/godot/blob/master/core/variant/array.h >`__
217- .. |typed_array | replace :: `TypedArray <https://github.com/godotengine/godot/blob/master/core/variant/array .h >`__
218- .. |packed_array | replace :: `Packed*Array <https://github.com/godotengine/godot/blob/master/core/variant/array .h >`__
221+ .. |typed_array | replace :: `TypedArray <https://github.com/godotengine/godot/blob/master/core/variant/typed_array .h >`__
222+ .. |packed_array | replace :: `Packed*Array <https://github.com/godotengine/godot/blob/master/core/variant/variant .h >`__
219223.. |list | replace :: `List <https://github.com/godotengine/godot/blob/master/core/templates/list.h >`__
220224.. |fixed_vector | replace :: `FixedVector <https://github.com/godotengine/godot/blob/master/core/templates/fixed_vector.h >`__
221225.. |span | replace :: `Span <https://github.com/godotengine/godot/blob/master/core/templates/span.h >`__
@@ -224,7 +228,7 @@ scripting API.
224228.. |a_hash_map | replace :: `AHashMap <https://github.com/godotengine/godot/blob/master/core/templates/a_hash_map.h >`__
225229.. |rb_map | replace :: `RBMap <https://github.com/godotengine/godot/blob/master/core/templates/rb_map.h >`__
226230.. |dictionary | replace :: `Dictionary <https://github.com/godotengine/godot/blob/master/core/variant/dictionary.h >`__
227- .. |typed_dictionary | replace :: `TypedDictionary <https://github.com/godotengine/godot/blob/master/core/variant/dictionary .h >`__
231+ .. |typed_dictionary | replace :: `TypedDictionary <https://github.com/godotengine/godot/blob/master/core/variant/typed_dictionary .h >`__
228232.. |pair | replace :: `Pair <https://github.com/godotengine/godot/blob/master/core/templates/pair.h >`__
229233
230234Math types
0 commit comments