]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
Allow wxAny to contain 'const char*' or 'const wchar_t*'. This was previously not...
[wxWidgets.git] / include / wx / list.h
index a84ee041bb9ed63357e60220e46eb01d05f6d4db..78e86ee6944990edcc805327bd6d7e249209a40f 100644 (file)
@@ -1010,11 +1010,22 @@ private:
         iterator insert(const iterator& it, const_reference v)              \
         {                                                                   \
             if ( it == end() )                                              \
+            {                                                               \
                 Append((const_base_reference)v);                            \
+                /*                                                          \
+                    note that this is the new end(), the old one was        \
+                    invalidated by the Append() call, and this is why we    \
+                    can't use the same code as in the normal case below     \
+                 */                                                         \
+                iterator itins(end());                                      \
+                return --itins;                                             \
+            }                                                               \
             else                                                            \
+            {                                                               \
                 Insert(it.m_node, (const_base_reference)v);                 \
-            iterator itprev(it);                                            \
-            return itprev--;                                                \
+                iterator itins(it);                                         \
+                return --itins;                                             \
+            }                                                               \
         }                                                                   \
         void insert(const iterator& it, size_type n, const_reference v)     \
         {                                                                   \