this:
generates this error:Code:friend vector<type, n> (::operator/<>)(const type div, const vector<type, n>& v);
vector.h:45: error: expected `)' before â<â token
why is that?
this:
generates this error:Code:friend vector<type, n> (::operator/<>)(const type div, const vector<type, n>& v);
vector.h:45: error: expected `)' before â<â token
why is that?
Probably because it's converting some of those characters into a different character. There are things like trigraphs that when put into code are converted to different characters. I don't know if that's what is happening here, but it's possible. That /<>) code looks suspicious.
You haven't probably forward declared the function.
I don't entirely understand your use of extra brackets and the scope operator (they just change the wording of the error message).Code://uncomment to fix /* template <class T> class X; template <class T> X<T> operator/(const T div, const X<T>& v); */ template <class T> class X { friend X<T> operator/<>(const T div, const X<T>& v); }; int main() { X<int> x; 10 / x; } //implementation template <class T> X<T> operator/(const T , const X<T>& ) { return X<T>(); }
Read more in C++ FAQ.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.