[英]help with doubly linked list?
I have a class LinkedList clas that has a class called Node 我有一个LinkedList clas类,它有一个名为Node的类
class Node {
public:
Node() { next = NULL; prev = NULL; }
~Node() {}
public :
Node *next;
Node *prev;
T data;
};
In the same LinkedList class i have the following function defininitions, because it is all in a header file 在同一个LinkedList类中,我有以下函数定义,因为它全部在头文件中
public:
LinkedList();
~LinkedList();
// methods -- note that the return values are of type T. Don't return a Node!
void append(T item);
T get(int idx);
void insert(int idx, T item);
void map(T (*pf)(T item));
T remove(int index);
int size();
void unshift(T item);
No I am trying to implement the operations 不,我正在尝试实施这些操作
first i need to return a new, empty Linked List. 首先,我需要返回一个新的空链表。
please help, i tried many things 请帮助,我尝试了很多东西
would it be as simple as 它会如此简单吗?
LinkedList<T>::LinkedList() {
head = NULL;
current = NULL;
}
Would it be as simple as? 会这么简单吗?
LinkedList<T>::LinkedList() {
head = NULL;
current = NULL;
}
Yes. 是。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.