队列
0.1
数据结构_第4章
|
循环队列类 More...
#include <seqQueue.hh>
Public Types | |
typedef T | value_type |
类型别名定义 More... | |
typedef value_type & | reference |
数据的引用 More... | |
typedef size_t | size_type |
计数器类型 More... | |
Public Member Functions | |
seqQueue (size_type initSize=10) | |
Construct a new seq Queue object. More... | |
virtual | ~seqQueue () |
Destroy the seq Queue object. More... | |
virtual bool | isEmpty () const |
判队空 More... | |
virtual void | enQueue (const_reference &x) |
入队一个元素 More... | |
virtual value_type | deQueue () |
出队一个元素 More... | |
virtual value_type | getHead () const |
Get the Head object. More... | |
bool | empty () const |
Test whether container is empty. More... | |
size_type | size () const |
Returns the number of elements in the queue. More... | |
reference & | front () |
Returns a reference to the next element in the queue. More... | |
const_reference & | front () const |
Returns a reference to the next element in the queue. More... | |
reference & | back () |
Returns a reference to the last element in the queue. More... | |
const_reference & | back () const |
Returns a reference to the last element in the queue. More... | |
void | push (const value_type &val) |
Inserts a new element at the end of the queue, after its current last element. More... | |
void | push (value_type &&val) |
Inserts a new element at the end of the queue, after its current last element. More... | |
void | pop () |
Removes the next element in the queue, effectively reducing its size by one. More... | |
virtual void | enQueue (const value_type &x)=0 |
入队一个元素 More... | |
Public Attributes | |
const typedef value_type & | const_reference |
数据的常量引用 More... | |
Private Member Functions | |
void | doubleSpace () |
扩大数组空间 More... | |
Private Attributes | |
value_type * | _elem |
存储元素的内部数组 More... | |
size_type | _maxSize |
数组的容量 More... | |
size_type | _front |
队头/尾下标 数据范围(front, rear]: 在循环意义下 初始状态: front == rear == 0 队列满: front == (rear + 1) % maxSize 队列空: front == rear More... | |
size_type | _rear |
循环队列类
T | 数据的类型 |
Definition at line 46 of file seqQueue.hh.
typedef value_type& Queue::seqQueue< T >::reference |
数据的引用
Definition at line 68 of file seqQueue.hh.
typedef size_t Queue::seqQueue< T >::size_type |
计数器类型
Definition at line 70 of file seqQueue.hh.
typedef T Queue::seqQueue< T >::value_type |
Queue::seqQueue< T >::seqQueue | ( | size_type | initSize = 10 | ) |
Construct a new seq Queue object.
initSize | 队列初始容量 |
Definition at line 216 of file seqQueue.hh.
|
virtual |
Destroy the seq Queue object.
Definition at line 222 of file seqQueue.hh.
seqQueue< T >::const_reference & Queue::seqQueue< T >::back |
Returns a reference to the last element in the queue.
Definition at line 252 of file seqQueue.hh.
const_reference& Queue::seqQueue< T >::back | ( | ) | const |
Returns a reference to the last element in the queue.
|
inlinevirtual |
出队一个元素
Implements Queue::Queue< T >.
Definition at line 143 of file seqQueue.hh.
Referenced by main().
|
private |
扩大数组空间
Definition at line 288 of file seqQueue.hh.
bool Queue::seqQueue< T >::empty |
Test whether container is empty.
Definition at line 228 of file seqQueue.hh.
Referenced by main().
|
pure virtualinherited |
入队一个元素
x | 数据的值 |
|
inlinevirtual |
入队一个元素
x | 元素的数据 |
Definition at line 133 of file seqQueue.hh.
Referenced by main().
seqQueue< T >::const_reference & Queue::seqQueue< T >::front |
Returns a reference to the next element in the queue.
Definition at line 240 of file seqQueue.hh.
const_reference& Queue::seqQueue< T >::front | ( | ) | const |
Returns a reference to the next element in the queue.
|
inlinevirtual |
Get the Head object.
Implements Queue::Queue< T >.
Definition at line 155 of file seqQueue.hh.
|
inlinevirtual |
判队空
Implements Queue::Queue< T >.
Definition at line 123 of file seqQueue.hh.
void Queue::seqQueue< T >::pop |
Removes the next element in the queue, effectively reducing its size by one.
Definition at line 282 of file seqQueue.hh.
void Queue::seqQueue< T >::push | ( | const value_type & | val | ) |
Inserts a new element at the end of the queue, after its current last element.
val | 数据的值 |
<
Definition at line 264 of file seqQueue.hh.
void Queue::seqQueue< T >::push | ( | value_type && | val | ) |
Inserts a new element at the end of the queue, after its current last element.
val | 数据的值 |
<
Definition at line 273 of file seqQueue.hh.
seqQueue< T >::size_type Queue::seqQueue< T >::size |
Returns the number of elements in the queue.
Definition at line 234 of file seqQueue.hh.
Referenced by main().
|
private |
存储元素的内部数组
Definition at line 77 of file seqQueue.hh.
|
private |
队头/尾下标 数据范围(front, rear]: 在循环意义下 初始状态: front == rear == 0 队列满: front == (rear + 1) % maxSize 队列空: front == rear
Definition at line 95 of file seqQueue.hh.
|
private |
|
private |
Definition at line 95 of file seqQueue.hh.
const typedef value_type& Queue::seqQueue< T >::const_reference |
数据的常量引用
Definition at line 69 of file seqQueue.hh.