Topic: [QUERY] template "partial" specializations


Author: John Lilley <jlilley@empathy.com>
Date: 1997/01/18
Raw View
Hello,

I have a question regarding the processing of class template
specializations, and the error-reporting therein.  Specifically, I am
unsure of when an error may/must be reported for a "partial"
specialization (if at all).  "partial" specialization is not the right
word for it; I do not have a name for it.  Let me give an example:

  template <class T1, class T2> class A {
     T1 t1;
     typename T2::I i;
  };
  class B { };
  template <class X> class C {
     A<X, B> ax;   // #1
  };

Should an error be reported at #1, because B::I is not a type?
Should the error be deferred until C is specialized?
May an implementation do it either way?

This leads to a broader question.  Does the A<X,B> above implictly
define a partial specialization of A<> that would preclude a later,
conflicting partial specialization definition, for example:

  template <class T1, class T2> class A {
     T1 t1;
     typename T2::I i;
  };
  class B { };
  template <class X> class C {
     A<X, B> ax;   // #1
  };
  template <class T> class A<T,B> {...};  // error?

It is clear from the draft that a full specialization of A<> disallows
any later partial specialization that would conflict, but I am unclear
about this case.

john lilley
---
[ 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                             ]