# HG changeset patch # User frosch # Date 2014-08-16 20:40:26 # Node ID 44b8e9a9a52340c4a57be9543a0330bf9e09fca0 # Parent b1ba238247ffdd6d85eca7d451d998faf04ff1a1 (svn r26742) -Doc: Why reverse_iterator is unsuitable for ScriptList iterators diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp --- 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: