15 #ifndef __SEQQUEUE_HH__
16 #define __SEQQUEUE_HH__
34 class seqQueue :
public Queue<T>
205 : _elem(new value_type[initSize]), _maxSize(initSize), _front(0), _rear(0)
218 return _front == _rear;
224 return ((_rear >= _front) ? _rear - _front : _maxSize + _rear - _front);
230 return _elem[(_front + 1) % _maxSize];
236 return _elem[(_front + 1) % _maxSize];
254 if (size() == _maxSize - 1)
257 _elem[_rear = (_rear + 1) % _maxSize] = val;
263 if (size() == _maxSize - 1)
266 _elem[_rear = (_rear + 1) % _maxSize] = std::move(val);
272 _front = (_front + 1) % _maxSize;
278 value_type *old = _elem;
279 _elem =
new value_type[2 * _maxSize + 1];
281 for (size_type i = 1; i <= size(); ++i)
282 _elem[i] = old[(_front + i) % _maxSize];
287 _maxSize = 2 * _maxSize + 1;