MY IT
[STL] LIST
메롱씨티 배드맨
2006. 7. 15. 13:57
/* ------- LIST EXAMPLE BEGIN ---------- */
#include <iostream>
#include <list>
using namespace std;
void display(list<string> *strList)
{
....list<string>::iterator sIter;
....sIter = strList->begin();
....while( sIter != strList->end() )
....{
........cout << "[" << *sIter << "] => ";
........*sIter++;
....}
....cout << endl;
}
int main( void )
{
....list<string> strList;
....strList.push_back("AAA");
....display(&strList);
....strList.push_back("BBB");
....display(&strList);
....strList.push_back("CCC");
....display(&strList);
....strList.push_back("DDD");
....display(&strList);
....
....strList.pop_back();
....display(&strList);
....strList.pop_front();
....display(&strList);
....return 0;
}
/* ------- LIST EXAMPLE END ------------ */