]> git.saurik.com Git - wxWidgets.git/commitdiff
fix other insert() overloads to work when inserting at the end of the list, continuat...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Feb 2009 23:46:53 +0000 (23:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Feb 2009 23:46:53 +0000 (23:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/list.h
tests/lists/lists.cpp

index 3a261249eea9a88bdf9f04f01a1f52f8fcebacaa..51ecad7972bd7314cfabd5bb75e44fce746bc517 100644 (file)
@@ -1019,13 +1019,13 @@ private:
         void insert(const iterator& it, size_type n, const_reference v)     \
         {                                                                   \
             for(size_type i = 0; i < n; ++i)                                \
         void insert(const iterator& it, size_type n, const_reference v)     \
         {                                                                   \
             for(size_type i = 0; i < n; ++i)                                \
-                Insert(it.m_node, (const_base_reference)v);                 \
+                insert(it, v);                                              \
         }                                                                   \
         void insert(const iterator& it,                                     \
                     const_iterator first, const const_iterator& last)       \
         {                                                                   \
             for(; first != last; ++first)                                   \
         }                                                                   \
         void insert(const iterator& it,                                     \
                     const_iterator first, const const_iterator& last)       \
         {                                                                   \
             for(; first != last; ++first)                                   \
-                Insert(it.m_node, (const_base_reference)*first);            \
+                insert(it, *first);                                         \
         }                                                                   \
         iterator erase(const iterator& it)                                  \
         {                                                                   \
         }                                                                   \
         iterator erase(const iterator& it)                                  \
         {                                                                   \
index ef259ba552245cc94d311ec9e09e2508164d830a..907e87c70af0e636eadb1211aab0962c081aae0f 100644 (file)
@@ -161,6 +161,17 @@ void ListsTestCase::wxStdListTest()
     it = list1.erase(++it, list1.end());
     CPPUNIT_ASSERT_EQUAL( 1, list1.size() );
     CPPUNIT_ASSERT( it == list1.end() );
     it = list1.erase(++it, list1.end());
     CPPUNIT_ASSERT_EQUAL( 1, list1.size() );
     CPPUNIT_ASSERT( it == list1.end() );
+
+    wxListInt list2;
+    list2.push_back((int *)3);
+    list2.push_back((int *)4);
+    list1.insert(list1.begin(), list2.begin(), list2.end());
+    CPPUNIT_ASSERT_EQUAL( 3, list1.size() );
+    CPPUNIT_ASSERT_EQUAL( (int *)3, list1.front() );
+
+    list1.insert(list1.end(), list2.begin(), list2.end());
+    CPPUNIT_ASSERT_EQUAL( 5, list1.size() );
+    CPPUNIT_ASSERT_EQUAL( (int *)4, list1.back() );
 }
 
 void ListsTestCase::wxListCtorTest()
 }
 
 void ListsTestCase::wxListCtorTest()