TITLE: Syntax for copy constructors in templates


PROBLEM: allen@eUNiiCE.canada.dg.com (%Allen B. Taylor), 11 Nov 93

Can anyone tell me if either of the two specifications for copy constructor and
assignment operator are correct or incorrect?  Borland C++ seems to accept both
forms, but Form 1 has been reject on other compilers I've tried.

	Form 1:
	template <class T>
 	class Blah
 	{
 	  T *x;
 	  public:
 	  Blah();
 	  Blah(Blah &);			// <--
 	  Blah &operator=(Blah &);	// <--
 	};
 
 	Form 2:
 	template <class T>
 	class Blah
 	{
 	  T *x;
 	  public:
 	  Blah();
 	  Blah(Blah<T> &);		// <---
 	  Blah &operator=(Blah<T> &)	// <---
 	};
 
I suspect that form 2 is closer to proposed ANSI, but the latest documentation
I have is the Ellis & Stroustrup ARM, which manages to avoid the subject
entirely.


RESPONSE: grumpy@cbnewse.cb.att.com (Paul J Lucas)
	  AT&T Bell Laboratories

Form 2 is legal and will always be accepted; form 1, I believe
is becoming legal.  IMHO, I wish they would have just picked one
and stuck with it.  Yet more confusion.


RESPONSE: rmartin@rcmcon.com (Robert Martin)

Form 2 is correct.  Form 1 is not.  The only time the template name
can be used without the formal argument list is when it is the name of
the constructor.


