Article View: comp.std.c++
Article #2861Re: Class template specialization ?
From: Anil Vijendran
Date: Wed, 06 Dec 1995 00:34
Date: Wed, 06 Dec 1995 00:34
39 lines
1816 bytes
1816 bytes
>>>>> On 4 Dec 1995 16:30:04 GMT, mlahteen@cs.Helsinki.FI (Mia
Lahteenmaki) said:
Mia> The WP draft (28 April,1995) describes class template
Mia> specializations in 14.6 [temp.class.spec]. I would like to
Mia> specialize collection class to use smart pointer (Ref)
Mia> element type. The typical template instantiation is
Mia> 'Collection<Ref<C>>' where C is some class.
Mia> template<class T> class Ref {...}; //primary template
Mia> template<class T1> class Collection {...};
Mia> // How should I declare now the specialization ? Like this?
Mia> template<class T1> class Collection<Ref<T> > {...};
Check out 14.7 (temp.param). It might be of use to you.
AFAIK (don't take my word for granted and pl correct me if I I'm
wrong), you could do it like this:
template <class T> class Ref { ... };
template <class T, template <class T> class RefType = Ref> class Collection { ... };
There is an example out there that does stuff like the above.
None of the compilers I have access to understand this baroque syntax.
--
Peace.... +<:-)
Anil
---
[ 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:
<xg3n397t710.fsf@marsh.cacs.usl.edu>Path:
arc1-ca.pugleaf.net!usenet.kornet.nm.kr!agate!agate!MattReferences:
<49ssga$2eu@hydra.cs.Helsinki.FI>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!usenet.kornet.nm.kr!agate!agate!Matt From: akv@cacs.usl.edu (Anil Vijendran) Newsgroups: comp.std.c++ Subject: Re: Class template specialization ? Date: 06 Dec 1995 00:34:10 GMT Organization: Center for Adv Computer Studies, Univ. of Southwestern Louisiana Approved: Matt@Austern Message-ID: <xg3n397t710.fsf@marsh.cacs.usl.edu> References: <49ssga$2eu@hydra.cs.Helsinki.FI> Reply-To: akv@cacs.usl.edu NNTP-Posting-Host: austern.hip.berkeley.edu