I am working on a class for a c++ project, and I have to overload all of my operators to work on vectors. Specifically, I define my vector as follows:
template<class Type>
ThreeVector<Type>::ThreeVector(Type x, Type y, Type z) {
mx=x;
my=y;
mz=z;
}
And my +operator as:
template<class Type>
ThreeVector<Type> operator+(const ThreeVector<Type>& v, const//
ThreeVector<Type>& w) {
return ThreeVector<Type>(v)+=w;
}
Where I have already overloaded the += and -= operators. However, I keep getting this error:
ThreeVT.cxx:12:26: error: no matching function for call to//
‘ThreeVector<double>::ThreeVector(ThreeVector<double>)’
ThreeVector<double> d=c+a;
ThreeVector.h:141:29: error: no matching function for call to
‘ThreeVector<double>::ThreeVector(const ThreeVector<double>&)’
return ThreeVector<Type>(v)+=w;
Any help would be much appreciated! This error seems to come up no matter what I do, and I don't know what it really means in this context.