mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
a9c943bef9
This PR implements range iterators in the base containers (Vector, Map, List, Pair Set). Given several of these data structures will be replaced by more efficient versions, having a common iterator API will make this simpler. Iterating can be done as follows (examples): ```C++ //Vector<String> for(const String& I: vector) { } //List<String> for(const String& I: list) { } //Map<String,int> for(const KeyValue<String,int>&I : map) { print_line("key: "+I.key+" value: "+itos(I.value)); } //if intending to write the elements, reference can be used //Map<String,int> for(KeyValue<String,int>& I: map) { I.value = 25; //this will fail because key is always const //I.key = "hello" } ``` The containers are (for now) not STL compatible, since this would mean changing how they work internally (STL uses a special head/tail allocation for end(), while Godot Map/Set/List do not). The idea is to change the Godot versions to be more compatible with STL, but this will happen after conversion to new iterators have taken place. |
||
---|---|---|
.. | ||
config | ||
crypto | ||
debugger | ||
error | ||
extension | ||
input | ||
io | ||
math | ||
object | ||
os | ||
string | ||
templates | ||
variant | ||
core_bind.cpp | ||
core_bind.h | ||
core_builders.py | ||
core_constants.cpp | ||
core_constants.h | ||
core_string_names.cpp | ||
core_string_names.h | ||
doc_data.cpp | ||
doc_data.h | ||
register_core_types.cpp | ||
register_core_types.h | ||
SCsub | ||
typedefs.h | ||
version.h |