Article View: comp.std.c++
Article #2053Re: typedef X;
From: Steve Clamage
Date: Wed, 27 Sep 1995 17:41
Date: Wed, 27 Sep 1995 17:41
33 lines
1749 bytes
1749 bytes
In article 9509261230@emerald.aifh.ed.ac.uk, andrewfg@aifh.ed.ac.uk writes:
>In article <MATT.95Sep20135311@physics2.Berkeley.EDU> 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.
>>
>
>I like keywords, but why not just use 'class' here? It is the existing
>idiom. Even for enums and builtins, it serves the purpose -- that of
>resolving the ambiguity -- and D&E says that 'class' is the C++ for 'type'.
It would create too many ambiguities. For example:
template<class base> class der : public base {
int f();
};
template<class base> int der<base>::f()
{
class T* tp; // supposing we took your suggestion
...
}
Is "class T" a forward declaration of a new type, or does it refer
to a type T inherited from "base"?
The word "class" has more than one meaning. One of its meanings is
"type" when used in template angle brackets, but that isn't its only meaning.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ 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:
<44br3e$d21@engnews2.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backReferences:
<5692.9509261230@emerald.aifh.ed.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 27 Sep 95 17:41:14 GMT Approved: fjh@cs.mu.oz.au From: clamage@Eng.Sun.COM (Steve Clamage) Newsgroups: comp.std.c++ Subject: Re: typedef X; X-Original-Date: 27 Sep 1995 15:37:18 GMT Organization: Sun Microsystems Inc. Message-ID: <44br3e$d21@engnews2.Eng.Sun.COM> References: <5692.9509261230@emerald.aifh.ed.ac.uk> Reply-To: clamage@Eng.Sun.COM