templated type as template type?
This question has probably come up before but I can't find an answer.
Why can't I declare something like:
Code:
TemplatedClassA<TemplatedClassB<int>> myFancyVariable;
The compiler refuses to recognize the syntax:
error: ISO C++ forbids declaration of 'TemplatedClassA' with no type
error: expected ';' before '<' token
Re: templated type as template type?
You can, in the next version of C++. For now:
Code:
TemplatedClassA<TemplatedClassB<int> > myFancyVariable;
to avoid greedy matching of >>
Re: templated type as template type?
It still doesn't compile. I get the same errors. My compiler is g++ 4.4.1.
Re: templated type as template type?
Post the smallest and simplest program that you think should compile but which results in the compile error that you are currently trying to fix.
Re: templated type as template type?
No, I'm sorry, "> >" did work ;-)
Re: templated type as template type?
Quote:
Originally Posted by
ssouffri
No, I'm sorry, "> >" did work ;-)
This C++ bug (or embarrassment as Stroustrup prefers to call it :)) is fixed in the next version.
Re: templated type as template type?
Quote:
Originally Posted by ssouffri
No, I'm sorry, "> >" did work ;-)
Good to hear :) I must say that the error message is a little puzzling though. Reading it again, I would have expected a different error message.