标签:ini stream struct push int inf rgba ios 初始化
1 #include <iostream> 2 #include <stdio.h> 3 #include <vector> 4 5 6 struct BoxInfo 7 { 8 int label; 9 float score; 10 }; 11 12 13 int bbox_init(std::vector<BoxInfo> &bboxs) 14 { 15 BoxInfo u_temp; 16 for(int i = 0; i < 10; i++) 17 { 18 u_temp.score = 0.8f +0.1f*i; 19 u_temp.label = i; 20 21 bboxs.push_back(u_temp); 22 } 23 24 return 0; 25 } 26 27 28 int main() 29 { 30 printf("begin \r\n"); 31 std::vector<BoxInfo> bboxs; 32 33 bbox_init(bboxs); 34 35 printf("mid \r\n"); 36 37 for(int i = 0; i < 10; i++) 38 { 39 printf("bboxs[%d].score = %f \r\n",i,bboxs[i].score); 40 printf("bboxs[%d].label = %d \r\n",i,bboxs[i].label); 41 } 42 printf("bboxs.size() = %d \r\n",bboxs.size()); 43 }
c++ 结构体容器(vector)类型初始化及结构体vector指针传递
标签:ini stream struct push int inf rgba ios 初始化
原文地址:https://www.cnblogs.com/iFrank/p/15017284.html