Article View: comp.std.c++
Article #3412Re: Template specialization with template?
From: Matt Austern
Date: Thu, 22 Feb 1996 20:29
Date: Thu, 22 Feb 1996 20:29
33 lines
1950 bytes
1950 bytes
In article <312BF6A1.5BBE@bnr.ca> "nicolas (n.) chapados" <chapados@bnr.ca> writes:
> It sometimes would be useful to have a template specialization be
> itself a template. For example, to define persistent I/O on all
> vectors of type T, one could specialize PersistentIO<T>:
>
> template <class T>
> class PersistentIO< vector<T> >
> { ... };
>
> I'd like to know whether this is allowed by the current draft.
> Given the affirmative, what does the T argument represent inside
> the specialization?
Yes, this is allowed. (So long as an unspecialized version of
PersistentIO<X> has been declared first.) This is known as partial
specialization, and it is described in section 14.6 [temp.class.spec]
of the draft standard. Partial specialization is used in the standard
class library.
Unfortunately, I don't know of any released compilers that have
actually implemented partial specialization.
--
Matt Austern
SGI: MTI Compilers Group
austern@isolde.mti.sgi.com
[ To submit articles: Try just posting with your newsreader.
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:
<AUSTERN.96Feb22095224@isolde.mti.sgi.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<312BF6A1.5BBE@bnr.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: austern@isolde.mti.sgi.com (Matt Austern) Newsgroups: comp.std.c++ Subject: Re: Template specialization with template? Date: 22 Feb 1996 20:29:03 GMT Organization: SGI Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <AUSTERN.96Feb22095224@isolde.mti.sgi.com> References: <312BF6A1.5BBE@bnr.ca> Reply-To: austern@cardboard.mti.sgi.com NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: isolde.mti.sgi.com In-Reply-To: "nicolas's message of 22 Feb 1996 09:13:53 PST Content-Length: 975 X-Lines: 26 Originator: clamage@taumet