树  0.1
数据结构_第6章
Queue::linkQueue< T > Class Template Reference

链接队列类 More...

#include <linkQueue.hh>

Inheritance diagram for Queue::linkQueue< T >:
Collaboration diagram for Queue::linkQueue< T >:

Classes

struct  node
 linkQueue的结点类 More...
 

Public Types

typedef T value_type
 类型别名定义 More...
 
typedef value_typereference
 数据的引用 More...
 
typedef size_t size_type
 计数器类型 More...
 

Public Member Functions

 linkQueue ()
 Construct a new link Queue object. More...
 
virtual ~linkQueue ()
 Destroy the link 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...
 
referencefront ()
 Returns a reference to the next element in the queue. More...
 
const_referencefront () const
 Returns a reference to the next element in the queue. More...
 
referenceback ()
 Returns a reference to the last element in the queue. More...
 
const_referenceback () 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. More...
 
void pop ()
 Removes the next element in the queue. More...
 

Public Attributes

const typedef value_typeconst_reference
 数据的常量引用 More...
 

Private Attributes

node_front
 指向队首结点 More...
 
node_rear
 指向队尾结点 More...
 
size_type _size
 队列中当前元素个数 More...
 
- Private Attributes inherited from Queue::Queue< T >
const typedef value_typeconst_reference
 数据的常量引用 More...
 

Additional Inherited Members

- Private Types inherited from Queue::Queue< T >
typedef T value_type
 类型别名定义 More...
 
typedef value_typereference
 数据的引用 More...
 
typedef size_t size_type
 计数器类型 More...
 
- Private Member Functions inherited from Queue::Queue< T >
virtual void enQueue (const value_type &x)=0
 入队一个元素 More...
 
virtual ~Queue ()=default
 Destroy the Queue object. More...
 

Detailed Description

template<typename T>
class Queue::linkQueue< T >

链接队列类

Template Parameters
T数据的类型

Definition at line 46 of file linkQueue.hh.

Member Typedef Documentation

◆ reference

template<typename T >
typedef value_type& Queue::linkQueue< T >::reference

数据的引用

Definition at line 68 of file linkQueue.hh.

◆ size_type

template<typename T >
typedef size_t Queue::linkQueue< T >::size_type

计数器类型

Definition at line 70 of file linkQueue.hh.

◆ value_type

template<typename T >
typedef T Queue::linkQueue< T >::value_type

类型别名定义

Note
测试:能否从基类继承 数据类型

Definition at line 67 of file linkQueue.hh.

Constructor & Destructor Documentation

◆ linkQueue()

template<class T >
Queue::linkQueue< T >::linkQueue

Construct a new link Queue object.

Definition at line 246 of file linkQueue.hh.

◆ ~linkQueue()

template<class T >
Queue::linkQueue< T >::~linkQueue
virtual

Destroy the link Queue object.

Definition at line 252 of file linkQueue.hh.

Member Function Documentation

◆ back() [1/2]

template<class T >
linkQueue< T >::const_reference & Queue::linkQueue< T >::back

Returns a reference to the last element in the queue.

Returns
reference& 队尾元素的引用

Definition at line 288 of file linkQueue.hh.

◆ back() [2/2]

template<typename T >
const_reference& Queue::linkQueue< T >::back ( ) const

Returns a reference to the last element in the queue.

Returns
const_reference& 队尾元素的常量引用

◆ deQueue()

template<typename T >
virtual value_type Queue::linkQueue< T >::deQueue ( )
inlinevirtual

出队一个元素

Returns
value_type

Implements Queue::Queue< T >.

Definition at line 173 of file linkQueue.hh.

◆ empty()

template<class T >
bool Queue::linkQueue< T >::empty

Test whether container is empty.

Returns
true is empty
false not empty

Definition at line 264 of file linkQueue.hh.

◆ enQueue()

template<typename T >
virtual void Queue::linkQueue< T >::enQueue ( const_reference x)
inlinevirtual

入队一个元素

Parameters
x元素的数据

Definition at line 163 of file linkQueue.hh.

◆ front() [1/2]

template<class T >
linkQueue< T >::const_reference & Queue::linkQueue< T >::front

Returns a reference to the next element in the queue.

Returns
reference& 队首元素的引用

Definition at line 276 of file linkQueue.hh.

◆ front() [2/2]

template<typename T >
const_reference& Queue::linkQueue< T >::front ( ) const

Returns a reference to the next element in the queue.

Returns
const_reference& 队首元素的常量引用

◆ getHead()

template<typename T >
virtual value_type Queue::linkQueue< T >::getHead ( ) const
inlinevirtual

Get the Head object.

Returns
value_type 队首元素的值

Implements Queue::Queue< T >.

Definition at line 185 of file linkQueue.hh.

◆ isEmpty()

template<typename T >
virtual bool Queue::linkQueue< T >::isEmpty ( ) const
inlinevirtual

判队空

Returns
true 队空
false 队非空

Implements Queue::Queue< T >.

Definition at line 153 of file linkQueue.hh.

◆ pop()

template<class T >
void Queue::linkQueue< T >::pop

Removes the next element in the queue.

Note
effectively reducing its size by one.

Definition at line 322 of file linkQueue.hh.

◆ push() [1/2]

template<class T >
void Queue::linkQueue< T >::push ( const value_type val)

Inserts a new element at the end of the queue, after its current last element.

Parameters
val数据的值

Definition at line 300 of file linkQueue.hh.

◆ push() [2/2]

template<class T >
void Queue::linkQueue< T >::push ( value_type &&  val)

Inserts a new element at the end of the queue.

Note
after its current last element
Parameters
val数据的值

Definition at line 311 of file linkQueue.hh.

References Queue::linkQueue< T >::node::_next.

◆ size()

template<class T >
linkQueue< T >::size_type Queue::linkQueue< T >::size

Returns the number of elements in the queue.

Returns
size_type

Definition at line 270 of file linkQueue.hh.

Member Data Documentation

◆ _front

template<typename T >
node* Queue::linkQueue< T >::_front
private

指向队首结点

Definition at line 120 of file linkQueue.hh.

◆ _rear

template<typename T >
node* Queue::linkQueue< T >::_rear
private

指向队尾结点

Definition at line 126 of file linkQueue.hh.

◆ _size

template<typename T >
size_type Queue::linkQueue< T >::_size
private

队列中当前元素个数

Definition at line 132 of file linkQueue.hh.

◆ const_reference

template<typename T >
const typedef value_type& Queue::linkQueue< T >::const_reference

数据的常量引用

Definition at line 69 of file linkQueue.hh.


The documentation for this class was generated from the following file: