我似乎很难激活一个节点类的类成员函数,我试图在数组类中为链表实现。在指出问题时,我将不胜感激。这些是相关的代码块:
background-size: auto 250%;
background-position: center center;
对于实施文件:
#ifndef LINK_H
#define LINK_H
#include <iostream>
#include <cstdlib>
namespace linkedlist{
class node {
typedef size_t value_type;
private:
value_type m_data;
node *m_link;
public:
//Constructor
node(const value_type& i_data = value_type(), node* i_link = NULL){
m_data = i_data;
m_link = i_link;
}
void list_copy (const node* source_ptr, node*& head_ptr, node*& tail_ptr);
链接列出的包
#include <iostream>
#include "Link.h"
#include <cassert>
#include <cstdlib>
using namespace linkedlist;
void node::list_copy (const node* source_ptr, node*& head_ptr, node*& tail_ptr){
head_ptr = NULL;
tail_ptr = NULL;
// Handle the case of the empty list.
if (source_ptr == NULL) return;
// Make the head node for the newly created list, and put data in it.
list_head_insert(head_ptr, source_ptr->data( ));
tail_ptr = head_ptr;
// Copy the rest of the nodes one at a time, adding at the tail of new list.
source_ptr = source_ptr->link( );
while (source_ptr != NULL) {
list_insert(tail_ptr, source_ptr->data( ));
tail_ptr = tail_ptr->link( );
source_ptr = source_ptr->link( );
}
}
node :: list_copy无法识别