C++指针的指针的作为形参vector容器操作
#include<iostream>
#include <vector>
#include "IPermanceServiceShare.h"
using namespace std;
void SetValue(vector<PERSON> **pvcDatas)
{
*pvcDatas = new vector<PERSON>();
PERSON *person = new PERSON();
person->strName = "ganquanfu";
person->nAge = 25;
(*pvcDatas)->push_back(*person);
person->strName = "ligang";
person->nAge = 35;
(*pvcDatas)->push_back(*person);
vector<PERSON>::iterator tem;
for (tem = (*pvcDatas)->begin(); tem != (*pvcDatas)->end(); ++tem)
{
cout << (*tem).strName << " " << (*tem).nAge << endl;
}
}
void main()
{
vector<PERSON> *vcDatas;
SetValue(&vcDatas);
cout << "************************************************" << endl;
vector<PERSON>::const_iterator tem;
for (tem = vcDatas->begin(); tem != vcDatas->end(); ++tem)
{
cout << (*tem).strName << " " << (*tem).nAge << endl;
}
int wait;
cin >> wait;
}