By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,245 Members | 1,103 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,245 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.