473,378 Members | 1,493 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,378 software developers and data experts.

Query: are typedef templates supported in C++. and on the VAC 6 compiler?

I'm trying to use the 'typedef templates' idiom, mentioned in
Alexandrescu's work on templates. Here's a Dr Dobbs article from 2002
that says they are a proposed C++ standard:
http://www.ddj.com/cpp/184403850

My compiler (Visual Age C 6.0) rejects them. Are they supported? Were
they ever introduced into the language standard?

Here is an example:

template<typename A, typename B class X { /* ... */ };
template<typename T typedef X<T,int Xi;
Xi<double Ddi; // equivalent to X<double,int>

The compiler flags the second line with an error: "A typedef
declaration must not be a template."

(Please reply to this group.)

Sep 17 '07 #1
2 1697
tropos wrote:
I'm trying to use the 'typedef templates' idiom, mentioned in
Alexandrescu's work on templates. Here's a Dr Dobbs article from 2002
that says they are a proposed C++ standard:
http://www.ddj.com/cpp/184403850

My compiler (Visual Age C 6.0) rejects them. Are they supported? Were
they ever introduced into the language standard?

Here is an example:

template<typename A, typename B class X { /* ... */ };
template<typename T typedef X<T,int Xi;
Xi<double Ddi; // equivalent to X<double,int>

The compiler flags the second line with an error: "A typedef
declaration must not be a template."
"template typedef" is a new language feature in C++0X,
I think your compiler does NOT support it

--
Thanks
Barry
Sep 17 '07 #2
On 2007-09-17 17:17, tropos wrote:
I'm trying to use the 'typedef templates' idiom, mentioned in
Alexandrescu's work on templates. Here's a Dr Dobbs article from 2002
that says they are a proposed C++ standard:
http://www.ddj.com/cpp/184403850

My compiler (Visual Age C 6.0) rejects them. Are they supported? Were
they ever introduced into the language standard?

Here is an example:

template<typename A, typename B class X { /* ... */ };
template<typename T typedef X<T,int Xi;
Xi<double Ddi; // equivalent to X<double,int>

The compiler flags the second line with an error: "A typedef
declaration must not be a template."
They are not part of the current standard (C++03), but will (probably)
be part of the next (C++0x) which is planned to be finished 2009. So
unless you compiler have some non-standard extensions they should not be
supported.

--
Erik Wikström
Sep 17 '07 #3

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

Similar topics

2
by: Steven T. Hatton | last post by:
If I understand correctly, a template is translated into its source equivalence, either explicitly, or implicitly. It seems to me, a tool that would show me that intermediate form of the template...
3
by: Generic Usenet Account | last post by:
This is a two-part question. (1) I have implemented a "Datastructure Registry" template class. I am getting no compiler warnings with older compilers, but newer compilers are generating the...
12
by: vvv | last post by:
Hi All, Do we have anything in .NET which is equivalent to C++'s Typedef . Regards, Vasanth
5
by: jimmy | last post by:
I am trying to simulate typedef template similar to the suggestion of Herb Sutter in the following article: http://www.gotw.ca/gotw/079.htm However when implementing typedef templates according...
4
by: Sacha | last post by:
I'm aware, that up to date, "typedef templates" are not defined within the C++ standard. The seemingly common workaround is this: template <class T> struct MyTypeDef { /* ultimately I need...
1
by: dhruba.bandopadhyay | last post by:
Am wondering whether Borland C++ 4.5 or Borland Turbo C++ 1.01 supported C++ templates. If not, which other future version of BC++ or TC++ did? If BC++ 4.5 or TC++ 1.01 does support it, how much...
5
by: Paul J. Lucas | last post by:
Given: template<typename T,typename Uclass C { }; template<typename Ttypedef C<T,intC2; I get: test.cpp:2: error: template declaration of 'typedef' Are template typedefs still not...
10
by: jlongstreet | last post by:
Please correct any misconceptions, or voice concerns about this being a stupid idea in general. I was wondering today: why doesn't C++ have explicit typedefs? explicit typedef unsigned int...
26
by: puzzlecracker | last post by:
Team, C++ has been around since 1986, why templates are still regarded is a new feature by most compiler vendors and not fully supported (for example export feature). Look at other popular...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.