queue
|
Container Adaptor |
Any sequence (Sequences) supporting operations front, back, push_back and pop_front can be used to instantiate queue. In particular, list (List) and deque (Deque) can be used.
value_type | Typedef on queue |
size_type | Typedef on queue |
bool empty () | Method on queue |
size_type size () | Method on queue |
value_type& front () | Method on queue |
value_type& back () | Method on queue |
void push (const value_type& x) | Method on queue |
void pop () | Method on queue |
== | Operator on queue |
< | Operator on queue |
templateclass queue { friend bool operator==(const queue & x, const queue & y); friend bool operator<(const queue & x, const queue & y); public: typedef Container::value_type value_type; typedef Container::size_type size_type; protected: Container c; public: bool empty() const { return c.empty(); } size_type size() const { return c.size(); } value_type& front() { return c.front(); } const value_type& front() const { return c.front(); } value_type& back() { return c.back(); } const value_type& back() const { return c.back(); } void push(const value_type& x) { c.push_back(x); } void pop() { c.pop_front(); } }; template bool operator==(const queue & x, const queue & y) { return x.c == y.c; } template bool operator<(const queue & x, const queue & y) { return x.c < y.c; }
|
|