2/20/2008

First touch stack in stl

I first use stack template in the standard template.

It's very usefull.

Push , pop and top methods are very simple.

Following code is my sample

#include <iostream>
#include <stack>
using namespace std;

int main(void)
{
stack<int> datas;// It's that stack contents are dequeue.
datas.push(0x01);
datas.push(0x10);
while( !datas.empty() ){
cout << datas.top() << endl;
datas.pop();
}
return 0;
}

No comments: