Article View: comp.std.c++
Article #2001Re: typedef X;
From: Craig P. Forbes
Date: Wed, 20 Sep 1995 20:53
Date: Wed, 20 Sep 1995 20:53
48 lines
2184 bytes
2184 bytes
In article <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com>, Etay_Bogner@mail.stil.scitex.com (Etay Bogner) writes:
|> In article <MATT.95Sep16194450@Austern>, Haim Kreitman
|> <haim_kreitman@mail.stil.scitex.com> wrote:
|>
|> >> typedef type1; // what does it mean ???
|>
|> >> [Moderator's note: the STL documentation has some "code" that isn't
|> >> code. This sort of line isn't supposed to be legal C++, it's just
|> >> supposed to indicate that type1 is a typedef for something. mha]
|>
|> Haim and me once thought that this is a forward declaration for a type.
|> While reading the draft, I've noticed that there is a new keyword,
|> "typename", that is used for that purpose.
|>
|> I think that STL should be updated to contain the "typename" keyword to
|> prevent confusion.
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.
for example:
template <T>
class foo {
typename T::i;
int var;
void fn() {
T::i *var; //without the typename keyword this could either be a declaration
//or an expression.
}
};
The typename keyword has been added since the September 1994 draft but I'm not
sure exactly when.
--
Craig P. Forbes McCabe & Associates
5501 Twin Knolls Road, Suite 111
craig@mccabe.com Columbia, MD 21045
---
[ 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.95Sep20135311@physics2.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<MATT.95Sep16194450@Austern> <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: craig@mccabe.com (Craig P. Forbes) Newsgroups: comp.std.c++ Subject: Re: typedef X; Date: 20 Sep 1995 20:53:11 GMT Organization: McCabe & Associates Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <MATT.95Sep20135311@physics2.Berkeley.EDU> References: <MATT.95Sep16194450@Austern> <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com> NNTP-Posting-Host: physics2.berkeley.edu