d_dnode.h
来自「这是数据结构和算法的国外经典书籍.清华大学出版社出版的<数据结构C++语言」· C头文件 代码 · 共 34 行
H
34 行
#ifndef DOUBLY_LINKED_NODE_CLASS
#define DOUBLY_LINKED_NODE_CLASS
template <typename T>
class dnode
{
public:
// the members of a dnode object are used for operations within a
// doubly linked list; access is simplified by making them public
T nodeValue; // data value of the node
dnode<T> *prev; // previous node in the list
dnode<T> *next; // next node in the list
// default constructor. creates object with value T(), the
// default value of type T. set the node pointers to point at
// the node itself
dnode()
{
next = this; // the next node is the current node
prev = this; // the previous node is the current node
}
// constructor with an argument to initialize nodeValue.
// set the node pointers to point at the node itself
dnode(const T& value): nodeValue(value)
{
next = this; // the next node is the current node
prev = this; // the previous node is the current node
}
};
#endif // DOUBLY_LINKED_NODE_CLASS
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?