List basics: push, begin, end pop
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<char> listObject;
int i;
for(i = 0; i <10; i++)
listObject.push_back('A'+i);
cout << "Size = " << listObject.size() << endl;
list<char>::iterator p;
cout << "Contents: ";
while(!listObject.empty()) {
p = listObject.begin();
cout << *p;
listObject.pop_front();
}
return 0;
}
Related examples in the same category