P
PengYu.UT
Hi,
I have the following class. I want the constructor gnuplot_2d(int size)
has the same behavior as if I call from the 2-argument constructor
gnuplot_2d(size, size). But the following definition doesn't work. Do
you have any idea?
Although I can define
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size) : _size_x(size),_size_y(size){
}
, it will be cumbersome if there are a lot of code in the function
body.
Best wishes,
Peng
template <typename __Tp>
class gnuplot_2d {
public:
gnuplot_2d(int size);
gnuplot_2d(int size_x, int size_y);
~gnuplot_2d(){};
private:
int _size_x;
int _size_y;
};
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size) : gnuplot_2d<__Tp>(size, size){
}
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size_x, int size_y) :
_size_x(size_x),_size_y(size_y){
}
I have the following class. I want the constructor gnuplot_2d(int size)
has the same behavior as if I call from the 2-argument constructor
gnuplot_2d(size, size). But the following definition doesn't work. Do
you have any idea?
Although I can define
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size) : _size_x(size),_size_y(size){
}
, it will be cumbersome if there are a lot of code in the function
body.
Best wishes,
Peng
template <typename __Tp>
class gnuplot_2d {
public:
gnuplot_2d(int size);
gnuplot_2d(int size_x, int size_y);
~gnuplot_2d(){};
private:
int _size_x;
int _size_y;
};
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size) : gnuplot_2d<__Tp>(size, size){
}
template <typename __Tp>
gnuplot_2d<__Tp>::gnuplot_2d(int size_x, int size_y) :
_size_x(size_x),_size_y(size_y){
}