[STL] DEQUE
/* ------------- DEQUE EXAMPLE BEGIN ------------- */
#include <iostream>
#include <deque>
using namespace std;
void display( deque<string> *strDeq )
{
....deque<string>::iterator sIter = strDeq->begin();
....cout << "<<전체 Deque의 데이터>>" << endl;
....for(int index=0; index < strDeq->size(); index++)
....{
........cout << "strDeq[" << index << "]:" << *sIter;
........*sIter++;
........cout << ", ";
....}
....cout << endl;
}
int main( void )
{
....deque<string> strDeq;
....strDeq.push_back("AAA");
....strDeq.push_back("BBB");
....strDeq.push_back("CCC");
....display( &strDeq );
....cout << endl << "(strDeq[2]를 DDD로 변환) " << endl;
....strDeq[2] = "DDD";
....display( &strDeq );
....cout << endl << "(111를 앞에 추가)" << endl;
....strDeq.push_front("111"); display( &strDeq );
....cout << endl << "(pop_back()와 pop_front() 실행)" << endl;
....strDeq.pop_back();
....strDeq.pop_front();
....display( &strDeq );
....return 0;
}
/* ------------- DEQUE EXAMPLE END --------------- */