【发布时间】:2020-05-13 23:08:44
【问题描述】:
我刚开始使用模板,想在我的头文件中以这种方式实现它,但是我遇到了各种错误,不明白为什么。
头文件:
#ifndef EXAM3_H_
#define EXAM3_H_
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
const int maxInt = 2147483647;
template <typename T>
struct nodeType {
T data;
nodeType *next;
};
bool search(nodeType *head, const T &searchItem);
void deleteNode(nodeType *&head, nodeType *&tail, int &count, const T &deleteItem);
void initializeList(nodeType *&head, nodeType *&tail, int &count);
bool isEmptyList(const nodeType *head);
void printList(nodeType *head);
int lengthList(nodeType *head);
void destroyList(nodeType *&head, nodeType *&tail, int &count);
void insert(const T &newItem, nodeType *&head, nodeType *&tail, int &count);
#endif
错误:
【问题讨论】: