【发布时间】:2015-06-17 06:01:54
【问题描述】:
我有一个如下所示的 c++ 泛型类:
template <class T, int N> class TwoDimArray{
private:
T tda_[N][N];
int n_;
public:
TwoDimArray(T tda[][N]){
..
}
~TwoDimArray(){
..
}
..
}
我将如何编写一个可以像这样调用的复制构造函数:
int a1[][2] = { 1, 2, 3, 4 };
TwoDimArray <int, 2> tdm1(a1);
TwoDimArray tdm1Copy (tmd1); // or whatever the correct form is
我希望我是清楚的。
【问题讨论】:
标签: c++ templates copy-constructor