Firedraco, thank you for pointing this out! I don't know why I made such a silly mistake. For the destructor I need to change to delete [] m_data;
, right? One further question is: is it always correct to use delete [] ptr? I made the following code
1 2 3
int *p = newint;
*p = 3;
delete [] p;
and it seems to run right.
Jsmith, thanks for your suggestion. Maybe my understanding is not right, but is the following a copy constructor?
But there is a compilation error. I think the declaration must be wrong, but I don't know where goes wrong ( I am still a bit confused by the rules of template ). Would you please point it out?