Topic: template class copy ctor/op= syntax?


Author: warsaw@nlm.nih.gov (Barry A. Warsaw)
Date: 15 Apr 1993 20:23:42 GMT
Raw View
What is the correct syntax for the definition of an out-of-line copy
ctor or op= for a template class?

cfront 3.0.2 wants only:

template <class FooRep>
Foo<FooRep>::Foo( const Foo<FooRep>& copy )
{ /* ... */ }  //----------^^^^^^^^ is required


while another compiler I've looked at wants only:

template <class FooRep>
Foo<FooRep>::Foo( const Foo& copy )
{ /* ... */ }  //----------^ mandates no template arguments


Unless I've missed the relevent section, my copy of the ARM doesn't
address this explicitly, although Stroustrup's 2nd seems to imply that
cfront is correct. The FAQ didn't give an answer either.

Which syntax is "legal":

1. cfront
2. other compiler
3. both
4. neither
5. um, that hasn't been decided yet

I want to know which vendor I should complain to, or if I should just
grin and bear all those #ifdefs... ;-)

Thanks,
-Barry