December 20th, 2009 09:46 AM
#1
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
December 20th, 2009 09:55 AM
#2
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 >>
December 20th, 2009 10:38 AM
#3
Re: templated type as template type?
It still doesn't compile. I get the same errors. My compiler is g++ 4.4.1.
December 20th, 2009 10:41 AM
#4
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.
December 20th, 2009 11:00 AM
#5
Re: templated type as template type?
No, I'm sorry, "> >" did work ;-)
December 20th, 2009 11:10 AM
#6
Re: templated type as template type?
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.
December 20th, 2009 11:18 AM
#7
Re: templated type as template type?
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.
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks