Article View: comp.std.c++
Article #3998Re: Template Syntax
From: Rich Paul
Date: Fri, 12 Apr 1996 01:16
Date: Fri, 12 Apr 1996 01:16
50 lines
2567 bytes
2567 bytes
Scott Meyers wrote:
>
> I was under the impression that the use of a template name inside the
> definition of a class template was implicitly considered to be qualified
> by the template parameter(s). For example, I thought that in
>
> template <class T>
> class Array {
> public:
> Array operator=(const Array& rhs);
> ...
> };
The following is a quote from the January '96 working paper. However, I'm told that
that document is already obsolete ( though I gather it's mostly in the library ...
[ moderator's note: the working paper is updated every four months. The January
version is the latest that has been published, but some changes were made at
the March meeting. -sdc ]
--- BEGIN WP QUOTE ---
1 Within the scope of a class template or a specialization of a template
the name of the template is equivalent to the name of the template
followed by the template-parameters enclosed in <>. [Example: the
constructor for Set can be referred to as Set() or Set<T>(). ] Other
specializations (_temp.spec_) of the class can be referred to by
explicitly qualifying the template name with appropriate template-
arguments. [Example:
template<class T> class X {
X* p; // meaning X<T>
X<T>* p2;
X<int>* p3;
};
template<class T> class Y;
template<> class Y<int> {
Y* p; // meaning Y<int>
};
--end example] [Note: see _temp.param_ for the scope of template-
parameters. ]
--- END WP QUOTE ---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4kkatd$e59@engnews1.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: Rich Paul <rpaul@trcinc.com> Newsgroups: comp.std.c++ Subject: Re: Template Syntax Date: 12 Apr 1996 01:16:29 GMT Organization: ? Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4kkatd$e59@engnews1.Eng.Sun.COM> NNTP-Posting-Host: taumet.eng.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Nntp-Posting-Host: bajor-le1.trcinc.com X-Lines: 54 Content-Length: 1598 Originator: clamage@taumet