私はC++でプログラミングしていて、2Dベクトルを手動で割り当て解除する必要があるかどうか疑問です。例:C++で2Dベクトルを解体する方法
class A{
private: vector<vector<int> > a;
public: A(vector<int> &input0,vector<int> &input1){
a.push_back(input0);
a.push_back(input1);
}
~A(){//should i do something here?}
}
int main(){
vector<int> a0(3);
vector<int> a1(3);
A my_A(a0,a1);
}
この例では、クラスAのデコンストラクタのprivate変数aを解体する必要がありますか?はいの場合、どうすればよいですか?
*手動で2dベクトルの割り当てを解除する必要がある場合* - 答えはいいえです。 – PaulMcKenzie
'ベクトル<>'はコンパイルされません。 –
関連性が非常に高い:http://stackoverflow.com/questions/4172722/what-is-the-rule-of-three – NathanOliver