Mega Code Archive

 
Categories / C++ Tutorial / List
 

Insert another list

#include <list> #include <iostream> using namespace std; typedef list<int> LISTINT; int main(void) {     int rgTest1[] = {5,6,7};     int rgTest2[] = {10,11,12};     LISTINT listInt;     LISTINT listAnother;     LISTINT::iterator i;     // Insert another LISTINT     listAnother.insert (listAnother.begin(), rgTest2, rgTest2+3);     listInt.insert (listInt.end(), listAnother.begin(), listAnother.end());     for (i = listInt.begin(); i != listInt.end(); ++i)         cout << *i << endl; }