Okay, so I've got a simple templated d-heap I'm trying to get compiled here. This is ironic because I'm trying to use this as part of my almost complete graph data structure and I can't even get something that should be simple to work! This is my first attempt at a template so maybe I'm missing something obvious. Anyways, here's some relevant bits of code:
Code:
#include <iostream>
#include <vector>
using namespace std;
template <class T,int dval>
class Heap
{
private:
vector<T> v;
public:
// constructor
Heap(void);
// heap methods
bool empty(void) const;
void insert (const T);
T remove (void);
};
template <class T>
Heap<T>::Heap (void)
{
//constructor stuff here
}
.
.
.
and here's some compilier errors:
Code:
In file included from graph.h:7,
from main.cpp:2:
heap.h:10: `Heap' is not a template type
heap.h:12: data member `v' cannot be a member template
heap.h:24: non-template type `Heap' used as a template
heap.h:25: ISO C++ forbids declaration of `Heap' with no type
heap.h:30: syntax error before `::' token
.
.
.
Thanks in advance for any direction!