D
Domenico Andreoli
i have a problem with the following code, it does not compile and i do
not understand why.
the interesting thing is that if function call_f is renamed to f the
compiler is happy.
any kind soul has any clue?
thanks
dom
$ g++ -c broken.cpp
broken.cpp: In function `T* call_f(A&)':
broken.cpp:15: error: syntax error before `>' token
$
----------- CUT HERE -----------
// broken.cpp
struct A
{
template<typename T>
T* f()
{
return 0;
}
};
template<typename T>
T* call_f(A& a)
{
return a.f<T>();
}
----------- CUT HERE -----------
-----[ Domenico Andreoli, aka cavok
--[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50
not understand why.
the interesting thing is that if function call_f is renamed to f the
compiler is happy.
any kind soul has any clue?
thanks
dom
$ g++ -c broken.cpp
broken.cpp: In function `T* call_f(A&)':
broken.cpp:15: error: syntax error before `>' token
$
----------- CUT HERE -----------
// broken.cpp
struct A
{
template<typename T>
T* f()
{
return 0;
}
};
template<typename T>
T* call_f(A& a)
{
return a.f<T>();
}
----------- CUT HERE -----------
-----[ Domenico Andreoli, aka cavok
--[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50