结构体中的vector, 怎么定义,怎么使用?
我想实现动态定义数组,所以我用vector
typedef struct{
unsigned short pt[100];
}USHORT1D;
typedef struct{
USHORT1D line[200];
}USHORT2D;
typedef struct{
vector<PLANE_OF_USHORT> zz;
}INFO;
INFO* inf;
void aaa(void* buffer){
USHORT2D *tmp = (USHORT2D*)malloc(sizeof(USHORT2D));
memcpy( tmp, buffer, sizeof(USHORT2D));
planes__->zz.push_back(*tmp);//为什么每次到这里都有问题,是不是vector用法错误??到底该怎么
}
int main(){
inf=(INFO*)malloc(sizeof(INFO));
do{
...获得 buffer,方法省略
aaa(buffer);
}while(blabla);
return 0;
}
谢谢大侠帮我看看