User Tools

Site Tools


cpp:stl:containers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
cpp:stl:containers [2020/05/28 16:40] – [Διαγραφή στοιχείου] gthanoscpp:stl:containers [2020/05/28 16:40] – [Διαγραφή στοιχείου] gthanos
Line 85: Line 85:
   for (int i=1; i<10; ++i) mylist.push_back(i*10);   for (int i=1; i<10; ++i) mylist.push_back(i*10);
  
-                              // 10 20 30 40 50 60 70 80 90 +                                          // 10 20 30 40 50 60 70 80 90 
-  it1 = it2 = mylist.begin(); // ^^ +  it1 = it2 = mylist.begin();             // ^^ 
-  advance (it2,6);            // ^                 ^ +  advance (it2,6);                        // ^                 ^ 
-  ++it1;                      //    ^              ^+  ++it1;                                  //    ^              ^
  
-  it1 = mylist.erase (it1);   // 10 30 40 50 60 70 80 90 +  it1 = mylist.erase (it1);               // 10 30 40 50 60 70 80 90 
-                              //    ^           ^+                                          //    ^           ^
  
-  it2 = mylist.erase (it2);   // 10 30 40 50 60 80 90 +  it2 = mylist.erase (it2);               // 10 30 40 50 60 80 90 
-                              //    ^           ^ +                                          //    ^           ^ 
-                              // 10 30 40 50 60 80 90 +                                          // 10 30 40 50 60 80 90 
-  ++it1;                      //              ^ +  ++it1;                                  //              ^ 
-  --it2;                      //           ^+  --it2;                                  //           ^
  
-  it1=mylist.erase (it1,it2); // 10 30 60 80 90 +  it1=mylist.erase (it1,it2);             // 10 30 60 80 90 
-                              //        ^+                                          //        ^
  
   std::cout << "mylist contains:";   std::cout << "mylist contains:";
cpp/stl/containers.txt · Last modified: 2022/05/26 16:49 by gthanos