c++.beta - malformed template with form g(f(x))
-
Richard Grant
(8/8)
Jun 28 2003
template
struct A {}; - Christof Meerwald (10/17) Jun 28 2003 should be:
- Richard Grant (5/17) Jun 29 2003 So the extra space helps identify the type? That's a little odd. But is ...
-
Richard Grant
(5/5)
Jun 29 2003
In article
- Rajiv Bhagwat (6/11) Jul 05 2003 The compiler uses "maximal munch" i.e.. grabs as many characters as poss...
template <class T> struct A {}; template <class T> struct B {}; template <class T> A<B<T>> fn() { return A<B<T>>(); } int main() { //Error: malformed template declaration fn<int>(); } Richard
Jun 28 2003
On Sat, 28 Jun 2003 21:29:06 +0000 (UTC), Richard Grant wrote:template <class T> struct A {}; template <class T> struct B {}; template <class T> A<B<T>> fn() { return A<B<T>>(); }should be: template <class T> A<B<T> > fn() { return A<B<T> >(); }int main() { //Error: malformed template declaration fn<int>(); }Well, the error message could be a bit clearer, but your code is not legal C++. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jun 28 2003
In article <bdm0cd$2jkm$1 digitaldaemon.com>, Christof Meerwald says...On Sat, 28 Jun 2003 21:29:06 +0000 (UTC), Richard Grant wrote:So the extra space helps identify the type? That's a little odd. But is in keeping with typeid having a space as I pointed out some time ago.template <class T> struct A {}; template <class T> struct B {}; template <class T> A<B<T>> fn() { return A<B<T>>(); }should be: template <class T> A<B<T> > fn() { return A<B<T> >(); }What is illegal about the code above? Richardint main() { //Error: malformed template declaration fn<int>(); }Well, the error message could be a bit clearer, but your code is not legal C++.
Jun 29 2003
In article <bdn8d1$nf3$1 digitaldaemon.com> Richard Grant says... not very much ;) ok forget about that last post. And thanks for correction. Richard
Jun 29 2003
The compiler uses "maximal munch" i.e.. grabs as many characters as possible to form a token, and ">>" is a valid operator. So, to use <T> followed by another >, you must leave a space in between. Rajiv "Richard Grant" <fractal clark.net> wrote in message news:bdndm0$t6h$1 digitaldaemon.com...In article <bdn8d1$nf3$1 digitaldaemon.com> Richard Grant says... not very much ;) ok forget about that last post. And thanks for correction. Richard
Jul 05 2003