473,549 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.cp p(3) : error C2954: template definitions
cannot nest
D:\my_projects\ testcpp\main.cp p(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\ testcpp\main.cp p(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\ testcpp\main.cp p(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\ testcpp\main.cp p(6) : error C2059: syntax error : '<end
Parse>'

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

Jun 29 '06 #1
4 5062
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.goo glegroups.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.cp p(3) : error C2954: template definitions
cannot nest
D:\my_projects\ testcpp\main.cp p(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\ testcpp\main.cp p(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\ testcpp\main.cp p(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\ testcpp\main.cp p(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.cp p(3) : error C2954: template definitions
cannot nest
D:\my_projects\ testcpp\main.cp p(3) : error C2951: template declarations
are only permitted at global or namespace scope
D:\my_projects\ testcpp\main.cp p(3) : error C2226: syntax error :
unexpected type 'T'
D:\my_projects\ testcpp\main.cp p(5) : error C2143: syntax error :
missing '>' before '{'
D:\my_projects\ testcpp\main.cp p(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
2454
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 wrong? I am using g++ (GCC) 3.3.5 on a Debian Sarge system. The compiler complains: //**************************** //****************************...
2
6829
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 as a value. Check out the following problem. I want to convert the value in <WpDatesXml> node to have a valid "<" and ">" instead of &lt or &gt...
3
3483
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 Beta 1, then Beta 2. I was using the <div runat="server"> statement on my projects. Once I placed a <div id="testdiv" runat="server"> within my...
4
7228
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
2151
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
2119
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 we have an integer list p, say. For each element x in p, we want to repace x with f(x) to get a new, possibly larger, integer list. Note
9
3411
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 {left_tag, right_tag, down_tag, up_tag) { fun(type()); }
3
1940
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 only way i can think to create each segment is by hardcoding the different elements into a string. For example, to create the N1 segment i'll do...
4
1413
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
7520
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.