473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

why it isn't compiled about "template< template<class> class T>"

Hi, all
I find "template template" class cann't been compiled in VC6 but can ok
in Redhat9. I write a test program like as:
template< template<class> class T>
class A
{
};
int main()
{
return 0;
}
compiling failed for message:
D:\my_projects\testcpp\main.cpp(3) : error C2954: template definitions
cannot nest
D:\my_projects\testcpp\main.cpp(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\testcpp\main.cpp(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\testcpp\main.cpp(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\testcpp\main.cpp(6) : error C2059: syntax error : '<end
Parse>'

Who can explain the reason to me. Thanks very much.

Jun 29 '06 #1
4 5045
Gary li wrote:
I find "template template" class cann't been compiled in VC6 [..]

Who can explain the reason to me. Thanks very much.


Have you looked at the release date of that compiler lately?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 29 '06 #2
Gary li wrote:
Hi, all
I find "template template" class cann't been compiled in VC6 but can ok
in Redhat9. I write a test program like as:

Who can explain the reason to me. Thanks very much.

Rather old and not very good compiler?

--
Ian Collins.
Jun 29 '06 #3
"Gary li" <li*************@sina.com> wrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi, all
I find "template template" class cann't been compiled in VC6 but can ok
in Redhat9. I write a test program like as:
template< template<class> class T>
class A
{
};
int main()
{
return 0;
}
compiling failed for message:
D:\my_projects\testcpp\main.cpp(3) : error C2954: template definitions
cannot nest
D:\my_projects\testcpp\main.cpp(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\testcpp\main.cpp(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\testcpp\main.cpp(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\testcpp\main.cpp(6) : error C2059: syntax error : '<end
Parse>'

Who can explain the reason to me. Thanks very much.


VC6 is old. Get a newer compiler.
Jun 29 '06 #4
Gary li wrote:
Hi, all
I find "template template" class cann't been compiled in VC6 but can ok
in Redhat9. I write a test program like as:
template< template<class> class T>
class A
{
};
int main()
{
return 0;
}
compiling failed for message:
D:\my_projects\testcpp\main.cpp(3) : error C2954: template definitions
cannot nest
D:\my_projects\testcpp\main.cpp(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\testcpp\main.cpp(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\testcpp\main.cpp(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\testcpp\main.cpp(6) : error C2059: syntax error : '<end
Parse>'

Who can explain the reason to me. Thanks very much.


Googling for C2954 yields the following link:
http://support.microsoft.com/kb/241940/en-us

Sadly enough, even the VC 7.0 compiler won't compile template template
arguments.

Regards,
Stuart
Jun 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: H. S. | last post by:
Hi, I am trying to compile these set of C++ files and trying out class inheritence and function pointers. Can anybody shed some light why my compiler is not compiling them and where I am going...
2
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
4
by: sods | last post by:
Hi, I write a test code about template used for strategy. it's very similar to sample code in TC++PL 13.4.1. #include <iostream> #include <string> using std::basic_string;
3
by: key9 | last post by:
Hi all I am confuse of how to override operate "<<" Sample , I've got 2 class class Terminal { public:
3
by: janzon | last post by:
Hi! Sorry for the bad subject line... Here's what I mean. Suppose we deal with C++ standard integers lists (the type is indifferent). We have a function f, declared as list<intf(int); Now...
9
by: PengYu.UT | last post by:
Hi, I have the code below this email. I want to replace the last 4 lines with a Metaprogramming loop to get something like the following (I don't know the syntax). Is it possible? for type in...
3
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, Below is sample output in x12 EDI format. I'm using vb.net to create this output file but i'm not sure if .NET has any tools to make the coding more organized and/or efficient. Right now the...
4
by: Ed | last post by:
Hi, guys, Here is a simple template class definition: template <typename T = int> class Point { public: T X; T Y; T Z; };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.