Here is my code and declarations, im not sure how to properly set up friend functions with template classes. Can someone please guide me on what I did wrong and why?
Thanks!
private:
int size;
T* buff;
friend Vector<T> operator * (const int n, const Vector<T> & v);
friend Vector<T> operator + (const int n, const Vector<T> & v);
template<typename T>
Vector<T> operator * (const int n, const Vector<T> & v){
Vector<T> vec(v.size);
vec.size = v.size;
for(int i = 0;i<vec.size;i++){
vec.buff[i] = v.buff[i]*n;
}
}
template<typename T>
Vector<T> operator+ (const int n, const Vector<T> & v){
Vector<T> vec(v.size);
vec.size = v.size;
for(int i = 0;i<vec.size;i++){
vec.buff[i] = v.buff[i]*n;
}
}