Topic: Overloading of templates


Author: riehle@swt1.informatik.uni-hamburg.de (Dirk Riehle)
Date: 22 Apr 1994 12:26:55 GMT
Raw View
To me it makes sense to have template classes with the same name, e.g.:

template< class A1 > class tEvent
{
  // Eventannouncement with one parameter of type A1
  virtual void Announce( A1 a1 ) {};
}

and

template< class A1, class A2 > class tEvent
{
  // Eventannouncement with two parameters of type A1 and A2
  virtual void Announce( A1 a1, A2 a2 ) {};
}

Our current version of gnu c++ doesn't accept it. Is it not allowed
or is gnu c++ wrong?

Dirk





Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Tue, 26 Apr 1994 14:27:29 GMT
Raw View
riehle@swt1.informatik.uni-hamburg.de (Dirk Riehle) writes:

>To me it makes sense to have template classes with the same name, e.g.:
>
>template< class A1 > class tEvent [...]
>template< class A1, class A2 > class tEvent [...]
>
>Our current version of gnu c++ doesn't accept it. Is it not allowed
>or is gnu c++ wrong?

It is not allowed.  ARM 14.1: "A class template name must be
unique in a program and mayj not be declared to refer to any
other template, class, function, object, value, or type in
the same scope".

--
Fergus Henderson - fjh@munta.cs.mu.oz.au