@@ -45,6 +45,8 @@ variables and ``nullptr`` is encouraged when possible. Still, try to keep your
45
45
use of modern C++ features conservative. Their use needs to serve a real
46
46
purpose, such as improving code readability or performance.
47
47
48
+ .. _doc_cpp_godot_types :
49
+
48
50
Standard Template Library
49
51
~~~~~~~~~~~~~~~~~~~~~~~~~
50
52
@@ -75,6 +77,7 @@ scripting API.
75
77
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
76
78
| ``Array `` 📜 | ``std::vector `` | Values can be of any Variant type. No static typing is imposed. |
77
79
| | | Uses shared reference counting, similar to ``std::shared_ptr ``. |
80
+ | | | Uses Vector<Variant> internally. |
78
81
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
79
82
| ``TypedArray `` 📜 | ``std::vector `` | Subclass of ``Array `` but with static typing for its elements. |
80
83
| | | Not to be confused with ``Packed*Array ``, which is internally a ``Vector ``. |
@@ -83,6 +86,8 @@ scripting API.
83
86
| | | Only a limited list of packed array types are available |
84
87
| | | (use ``TypedArray `` otherwise). |
85
88
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
89
+ | ``FixedVector `` | ``std::array `` | Vector with a fixed capacity (more similar to ``boost::container::static_vector ``). |
90
+ +------------------------+--------------------------+---------------------------------------------------------------------------------------+
86
91
| ``List `` | ``std::list `` | Linked list type. Generally slower than other array/vector types. Prefer using |
87
92
| | | other types in new code, unless using ``List `` avoids the need for type conversions. |
88
93
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
@@ -99,7 +104,7 @@ scripting API.
99
104
| | | This means it's generally slower but can be copied around almost for free. |
100
105
| | | The performance benefits of ``VSet `` aren't established, so prefer using other types. |
101
106
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
102
- | ``HashMap `` | ``std::unordered_map `` | **Use this as the "default" map type. ** Does not preserve insertion order. |
107
+ | ``HashMap `` | ``std::unordered_map `` | **Use this as the "default" map type. ** Preserves insertion order. |
103
108
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
104
109
| ``AHashMap `` | ``std::unordered_map `` | Array-based implementation of a hash map. Does not preserve insertion order. |
105
110
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
@@ -114,6 +119,7 @@ scripting API.
114
119
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
115
120
| ``Dictionary `` 📜 | ``std::unordered_map `` | Keys and values can be of any Variant type. No static typing is imposed. |
116
121
| | | Uses shared reference counting, similar to ``std::shared_ptr ``. |
122
+ | | | Preserves insertion order. Uses ``HashMap<Variant> `` internally. |
117
123
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
118
124
| ``TypedDictionary `` 📜 | ``std::unordered_map `` | Subclass of ``Dictionary `` but with static typing for its keys and values. |
119
125
+------------------------+--------------------------+---------------------------------------------------------------------------------------+
0 commit comments