Mega Code Archive

 
Categories / C++ Tutorial / List
 

Insert an array in there

#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 an array in there     listInt.insert (listInt.end(), rgTest1, rgTest1 + 3);     for (i = listInt.begin(); i != listInt.end(); ++i)         cout << *i << endl; }