31 #ifndef COMMON_STD_QUEUE_H 32 #define COMMON_STD_QUEUE_H 34 #include "common/std/algorithm.h" 35 #include "common/std/vector.h" 36 #include "common/queue.h" 48 template<
class T,
class Container = vector<T>,
class Comparitor =
typename Common::Less<T> >
52 Comparitor _comparitor;
57 return _container.empty();
60 const T &top()
const {
61 return _container.front();
64 void push(
const T &item) {
65 _container.push_back(item);
66 Common::sort(_container.begin(), _container.end(), _comparitor);
70 _container.remove_at(0);
80 typedef typename vector<T>::iterator iterator;
81 typedef const typename vector<T>::const_iterator const_iterator;
88 void insert(
const T &item) {
91 void push_back(
const T &item) {
94 void push_front(
const T &item) {
95 _intern.push_front(item);
103 const T &front()
const {
104 return _intern.
front();
106 const T &back()
const {
107 return _intern.
back();
110 void resize(
size_t newSize) {
114 size_t size()
const {
115 return _intern.
size();
122 const_iterator cbegin() {
123 return _intern.cbegin();
125 const_iterator cend() {
126 return _intern.cend();
128 reverse_iterator rbegin() {
129 return _intern.rbegin();
131 reverse_iterator rend() {
132 return _intern.rend();
134 const_reverse_iterator rbegin()
const {
135 return _intern.rbegin();
137 const_reverse_iterator rend()
const {
138 return _intern.rend();
140 const_reverse_iterator crbegin()
const {
141 return _intern.crbegin();
143 const_reverse_iterator crend()
const {
144 return _intern.crend();
void clear()
Definition: array.h:320
T & front()
Definition: array.h:217
void push_back(const T &element)
Definition: array.h:180
void pop_back()
Definition: array.h:199
size_type size() const
Definition: array.h:315
void resize(size_type newSize)
Definition: array.h:411
T remove_at(size_type idx)
Definition: array.h:260
void sort(T first, T last, StrictWeakOrdering comp)
Definition: algorithm.h:349
Definition: algorithm.h:37
T & back()
Definition: array.h:229