Topic: Rationale for asymmetry


Author: "Andrei Alexandrescu" <andrewalex@hotmail.com>
Date: 2000/05/22
Raw View
Hyman Rosen pointed twice that explicit specialization of a nested
(member) class template must be *outside* its host class, while
partial specialization of a member class template can be defined
either *inside* or *outside* the host class.

Example:

class A
{
    template <class T> class B {};
    template <> class B<int> {}; // illegal
};

class C
{
    template <class T> class D {};
    template <class T> class D<T*> {}; // groovy
};


Is there a rationale for this asymmetry? If not, does it have to do
with backwards compatibility and the fact that partial specialization
is newer than explicit specialization? Thanks.


Andrei

P.S. I was careful this time. In my previous posts, I repeatedly
misspelled "asymmetry" as "assymetry". I apologize for any confusion
that I might have created.




---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]