Title
Partial specialization of member templates of class templates
Status
open
Section
13.7.6 [temp.spec.partial]
Submitter
James Widman

Created on 2008-08-08.00:00:00 last changed 190 months ago

Messages

Date: 2008-08-08.00:00:00

The Standard does not appear to specify clearly the effect of a partial specialization of a member template of a class template. For example:

    template<class T> struct B {
         template<class U> struct A { // #1
             void h() {}
         };
         template<class U> struct A<U*> {  // #2
             void f() {}
         };
    };

    template<> template<class U> struct B<int>::A { // #3
         void g() {}
    };

    void q(B<int>::A<char*>& p) {
         p.f();  // #4
    }

The explicit specialization at #3 replaces the primary member template #1 of B<int>; however, it is not clear whether the partial specialization #2 should be considered to apply to the explicitly-specialized member template of A<int> (thus allowing the call to p.f() at #4) or whether the partial specialization will be used only for specializations of B that are implicitly instantiated (meaning that #4 could call p.g() but not p.f()).

History
Date User Action Args
2008-08-08 00:00:00admincreate