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

T

tropos

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.)
 
B

Barry

tropos said:
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
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top