#pragma once
class TestDeque
{
//deque 双向队列,可用于队列次序与插入次序相反的情况或栈情况
public:
TestDeque(void);
virtual ~TestDeque(void);
void test();
};
//--------------------------------------------------------------------------------
#include "TestDeque.h"
#include <deque>
#include <iostream>
using namespace std;
TestDeque::TestDeque(void)
{
}
TestDeque::~TestDeque(void)
{
}
void TestDeque::test()
{
deque<int> coll;
for(int i=1; i<=6; ++i)
{
coll.push_front(i);
}
for(int i=0,size = coll.size(); i<size; ++i)
{
cout<<coll[i]<<' ';
}
cout<<endl;
}