![]() |
| | #1 |
| Registered User Join Date: Jan 2008
Posts: 562
| friend function template class declaration 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? |
| -EquinoX- is offline | |
| | #2 |
| Registered User Join Date: Jan 2005
Posts: 7,252
| 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. |
| Daved is offline | |
| | #3 | |
| The larch Join Date: May 2006
Posts: 3,222
| You haven't probably forward declared the function. 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. Quote:
| |
| anon is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another syntax error | caldeira | C Programming | 31 | 09-05-2008 01:01 AM |
| Quantum Random Bit Generator | shawnt | C++ Programming | 62 | 06-18-2008 10:17 AM |
| Dikumud | maxorator | C++ Programming | 1 | 10-01-2005 06:39 AM |
| C++ compilation issues | Rupan | C++ Programming | 1 | 08-22-2005 05:45 AM |
| Interface Question | smog890 | C Programming | 11 | 06-03-2002 05:06 PM |