template<class T,class container=deque<T> >
class queue
{
public:
explicit queue(container &cn=container());
//dafault constructor initializes an empty queue
//precondition :None
//postcondition :An empty queue exists;
bool empty()const;
//determines if the queue is empty
//precondition :None
//postcondition :return true if the queue is empty
//otherwise returns false
size_type size()const;
//determines the size of the queue ,the return type
//size_type is an integral type.
//precondition :None;
//postcondition:return the number of items that are
//currently in the queue
T &front();
//returns a reference to the first item of the queue
//precondition :none
//postcondition :the item is not removed from the queue
T &back();
//return a reference to the last item of the queue
//precondition :none
//postcondition :the item is not removed from the queue
void pop();
//removes the first item in the queue;
//precondition :none
//postcondition:the item at the front of the queue
//is removed
void push(const T &x);
//Inserts an item to the back of the queue
//precondition :none
//postcondition :the item x is at the back of the queue.
};
stl类queue
最新推荐文章于 2025-04-21 20:32:13 发布