Topic: Template function inheritance problem


Author: documen@CAM.ORG (Ozgen Eryasa)
Date: 20 Oct 1994 14:39:59 -0400
Raw View
 Hi all,

 I have the following problem using my Symantec for version 7 C++
compiler: The following piece of code is not accepted with the error that
operator B<void *>:++() is undefined, yet Borland C++ 3.0 compiles that
with no complaints.

 template <class T> class B
 {
  public:
  ...
  T operator ++() {
    ...
    Alpha += ...
    ...
  }
  ...
  private:
  int Alpha;
  ...
 };

 template <class T> class A: public B<void *>
 {
  public:
  ...
  T *operator ++();
  ...
 }

 template <class T> T *A(T)::operator ++()
 {
  ...
  B<void *>::operator ++(); // OK for Borland, Error for Symantec
  ...
 }

 As you can see, this basically consists in a template function
calling another template function which is related to the class it
belongs to by a parental relationship.
 Is there any standard regarding this? Actually this example
belongs to Borland's class library that I am trying to recompile for Mac
using Symantec. Anybody can help me out there?

   TIA,

     Ozgen