I can’t comment on why this is how it is, but here’s how you write a copy constructor and assignment operator for a class template:
template <class T>
class A
{
public:
A(const A &){}
A & operator=(const A& a){return *this;}
};
and that’s it.
The trick here is that even though A
is a template, when you refer to it inside the class as A
(such as in the function signatures) it is treated as the full type A<T>
.