summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-08-16 20:40:26 +0000
committerfrosch <frosch@openttd.org>2014-08-16 20:40:26 +0000
commit0d561bcf572d75b0a0ef6f6c2721713f54a1693d (patch)
tree49682d7416b88f13caa046b5e068480a34b2396e
parentc775ffe530c285862826377b83d85c8b959804e0 (diff)
downloadopenttd-0d561bcf572d75b0a0ef6f6c2721713f54a1693d.tar.xz
(svn r26742) -Doc: Why reverse_iterator is unsuitable for ScriptList iterators
-rw-r--r--src/script/api/script_list.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index 7add90c74..e0dba50bc 100644
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -151,6 +151,9 @@ public:
*/
class ScriptListSorterValueDescending : public ScriptListSorter {
private:
+ /* Note: We cannot use reverse_iterator.
+ * The iterators must only be invalidated when the element they are pointing to is removed.
+ * This only holds for forward iterators. */
ScriptList::ScriptListBucket::iterator bucket_iter; ///< The iterator over the list to find the buckets.
ScriptList::ScriptItemList *bucket_list; ///< The current bucket list we're iterator over.
ScriptList::ScriptItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
@@ -315,6 +318,9 @@ public:
*/
class ScriptListSorterItemDescending : public ScriptListSorter {
private:
+ /* Note: We cannot use reverse_iterator.
+ * The iterators must only be invalidated when the element they are pointing to is removed.
+ * This only holds for forward iterators. */
ScriptList::ScriptListMap::iterator item_iter; ///< The iterator over the items in the map.
public: