16,548
社区成员




void functionA(std::vector<std::string>& stringList);
std::vector<DeviceInfo> deviceInfoList; //DeviceInfo是表示设备信息的结构体
int nRet = GetDeviceInfoList(deviceInfoList); //将deviceInfoList作为参数传入,然后用返回值判断数据获取成功与否
.........
//函数声明形式为
int GetDeviceInfoList(std::vector<DeviceInfo>& infoList);
std::vector<DeviceInfo>& GetDeviceInfoList(); //函数的声明
......
std::vector<DeviceInfo>& devInfoList = GetDeviceInfoList(); //函数的调用处,此处接收GetDeviceInfoList()函数返回值的devInfoList变量必须定义为引用