I have the following class:
template <typename T>
class Fixed2DContainer {
T* ptr;
public:
const int total_cols;
const int total_rows;
Fixed2DContainer(int cols, int rows);
T& operator()(int col_n, int row_n);
~Fixed2DContainer();
private : //disallow copy
Fixed2DContainer& operator=(const Fixed2DContainer&);
Fixed2DContainer operator()(const Fixed2DContainer&);
};
Now I’d like to specialize this template for some class so that the only change is that I can have an another constructor.
Basically I want to be able to do:
Fixed2DContainer<Image>("filename.jpg");
is there an elegant way to do this? I am fairly new to template so i have no idea of the difficulty
Here’s a quick example of what I meant in my earlier comment …
N.B. because the base class is non-copyable the derived classes will be too. It may not be necessary to define a destructor in the derived classes if all the cleanup can be done by the base destructor.