Angelscript addon Template Containers
2.31.0
STL container powerr for Angelscript
|
Iterators are named "CONTAINERNAME_iterator". Iteration is done with only one function for better runtime performance. The iterators' constructor takes a handle to the host container. Iterators can also be constructed with "container::begin()" and "container::end()".
Iterator script interface:
The "next" method evaluates iteration ending and advances the iterator.
The "map" and "unordered_map" containers' iterators can access both the key and value with the same iterator. Their iterators dont have a "current" method, instead they have "current_key" and "current_value". "current_key" returns a const reference to preserve the container's ordering.
Example of iterating through a vector, neatest syntax:
Example of iterating through a vector, clunkiest syntax:
Both print:
Note how the third parameter of the for loop is empty.
Example of iterating through a map:
Prints: