Topic: Template typedefs


Author: brok@rubikon.pl ("Bronek Kozicki")
Date: Mon, 18 Apr 2005 22:49:57 GMT
Raw View
Samee Zahur <samee.zahur@gmail.com> wrote:
> Hi everyone,
> I was just wondering if the standard allows this sort of templated
> typedefs are allowed in the standard.
>
> template <class X,class Y> class tclass {/*...*/};
> template <class X> typedef tclass<X,int> newclass<x>;

such thing is likely to appear in C++ 0x, but syntax would be slightly
different. For details see
http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2003/n1489.pdf


B.

(moderator : feel free to drop this message if someone else already
replied)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: ben-public-nospam@decadentplace.org.uk (Ben Hutchings)
Date: Tue, 19 Apr 2005 01:58:45 GMT
Raw View
Samee Zahur wrote:
> Hi everyone,
> I was just wondering if the standard allows this sort of templated
> typedefs are allowed in the standard.
<snip>

No, there's currently no such thing as a typedef template.  However
there has been a proposal for a more general feature of "template
aliases" to be included in the next standard:
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1449.pdf>.

--
Ben Hutchings
For every complex problem
there is a solution that is simple, neat, and wrong.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "Samee Zahur" <samee.zahur@gmail.com>
Date: Sun, 17 Apr 2005 14:09:51 CST
Raw View
Hi everyone,
I was just wondering if the standard allows this sort of templated
typedefs are allowed in the standard.

template <class X,class Y> class tclass {/*...*/};
template <class X> typedef tclass<X,int> newclass<x>;

Where in the second line I'm basically aiming to do more or less the
same thing this would:

template <class X> class newclass:public tclass<X,int> {};


It's just that the typedef kind of statements make the sense of the job
clearer to the reader.

Samee

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]