값이 0 인 클래스의 컨스트럭터에서 2 차원 벡터를 어떻게 초기화 할 수 있습니까? 이 작동하지 않습니다클래스의 생성자에서 벡터를 초기화하는 방법
#include <vector>
using namespace std;
class matrix {
public:
typedef int element_type;
matrix(int dim):data(dim, vector<int>(dim, 0)) {
}
private:
vector<vector<element_type>> data;
};
내가 벡터를 무료로 소멸자를 작성해야합니까?
C++ 0x는이 성가심을 해결해야합니다. – Steve314