Reputation: 901
Can anyone help me understand why I am getting the following error?
'vcr’ is not a template
Here is the template class declaration:
#include <iostream>
#include <complex>
using namespace std;
template<class T>
class vcr<complex <T> >
{
int length;
complex<T>* vr;
public:
vcr(int, const complex<T>* const);
vcr(int =0, complex<T> =0);
vcr(const vcr&);
~vcr() {delete[] vr;}
int size() const{ return length;}
complex<T>& operator[](int i) const { return vr[i];}
vcr& operator+=(const vcr&);
T maxnorm() const;
template<class S>
friend complex<S> dot(const vcr<complex<S> >&, const vcr<complex<S> >&);
};
Upvotes: 4
Views: 563
Reputation: 39089
template<class T> class vcr<complex <T> >{
... is a partial template specialization. There is a missing general variant, which would (at least) look like this, and which must be visible at the point of the partial specialization:
template<class T> class vcr;
You do not need to provide a body for the general form.
Upvotes: 3