Article View: comp.std.c++
Article #2016typename versus typedef (was Re: typedef X;)
From: Alex Martelli
Date: Sat, 23 Sep 1995 20:54
Date: Sat, 23 Sep 1995 20:54
40 lines
1894 bytes
1894 bytes
craig@mccabe.com (Craig P. Forbes) writes:
...
>My understanding is that the typename keyword may only be used in templates
>to identify subtypes of the template parameters, which otherwise can not be
>identified as a type.
...
>template <T>
>class foo {
> typename T::i;
> int var;
> void fn() {
> T::i *var; //without the typename keyword this could either be a declaration
<blink>? What happened to minimalism...? Couldn't this be just as
well have been coded...:
typedef T::i dummynameoftype; // no syntax ambiguity here
...
dummynameoftype *var; // no ambiguity here either
Was a whole new keyword really introduced just for the purpose of
avoiding the template author the chore of thinking up a dummy type
name in this situation...? Or am I missing something here...?
Alex
--
DISCLAIMER: these are TOTALLY personal opinions and viewpoints, NOT connected
in any way with my employer, nor any other organization or individual!
Email: martelli@cadlab.it Phone: +39 (51) 597313
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia Fax: +39 (51) 597120
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<MATT.95Sep23125440@Austern>Path:
arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!MattReferences:
<MATT.95Sep16194450@Austern> <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com> <MATT.95Sep20135311@physics2.Berkeley.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt From: martelli@cadlab.cadlab.it (Alex Martelli) Newsgroups: comp.std.c++ Subject: typename versus typedef (was Re: typedef X;) Date: 23 Sep 1995 20:54:40 GMT Organization: Cad.Lab Spa, Bologna, Italia Approved: matt@austern.hip.berkeley.edu Message-ID: <MATT.95Sep23125440@Austern> References: <MATT.95Sep16194450@Austern> <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com> <MATT.95Sep20135311@physics2.Berkeley.EDU> NNTP-Posting-Host: austern.hip.berkeley.edu