【发布时间】:2013-07-14 02:20:05
【问题描述】:
假设我有一门课,A
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 G sdfg ersg s
提前谢谢你。
【问题讨论】:
-
清空数组是什么意思?
-
如果数组有 [1,2,3,4] 那么我想把它设为 []。
-
嗯.. 语法对于初学者来说并不真正有效。考虑解决这个问题。
-
你不能那样做。数组声明后无法调整大小。
-
类不是函数。
标签: c++ arrays pointers vector iterator