0

我在模板化优先级队列的头文件中有这个;

template <typename ElemType>
class HeapPQueue {
public:
    HeapPQueue<ElemType>();
    ~HeapPQueue<ElemType>();

ETC

这在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”。为什么?

4

0 回答 0