/清晰矢量和陣列比方說,我有一個類,A我怎麼清空C++
Class A {
int x[100];
vector<int> y;
Fill(x);
Fill(y.begin());
B(x);
B(y.begin());
}
Class Fill (pointer) {
*pointer = 0;
++pointer;
*pointer = 1;
++pointer
}
Class B(container) {
//how do I clear/empty the array and the vector passed by class A given only the pointers to them?
//I must clear an array and a vector in THIS class.
//I DO NOT want to fill them with 0s.
//x and y.begin are POINTERS to the first element of the container, not containers
}
dsfsdakfgnsdfgsf DG 自衛隊 陸上自衛隊 ghsdf 摹 sdfg ersg 小號
先謝謝你。
你是什麼意思清除數組? –
如果數組有[1,2,3,4],那麼我想讓它[]。 – Nayana
呃..語法對於初學者來說並不真正有效。考慮解決這個問題。 – Rapptz