我已经在头文件中找到了一个模板化的优先级队列;
template <typename ElemType>
class HeapPQueue {
public:
HeapPQueue<ElemType>();
~HeapPQueue<ElemType>();
等
这是在cpp文件中;
#include "pqueue-heap.h"
#include "cmpfn.h"
#include "error.h"
using namespace std;
template <typename ElemType>
HeapPQueue<ElemType>::HeapPQueue() {
capacity = START_CAPACITY;
heap = new ElemType[capacity];
logSize = 0;
}
template <typename ElemType>
HeapPQueue<ElemType>::~HeapPQueue() {
delete[] heap;
}
我收到错误消息“未知类型名称HeapPQueue”。为什么呢?