OpenCV:resize函数 VS vector:resize函数( 二 )



5应用:
#include <iostream>
#include <vector>
using namespace std;
int main()
{     
       vector <int> wgw;
       cout << "initilize size is: " << wgw.size() << l;
       cout << "initilize capacity is :" << wgw.capacity() <<l;
       wgw.reserve(100);
       cout << "wgw size is: " << wgw.size() << l;
       cout << "wgw capacity is :" << wgw.capacity() <<l;
       vector <int>wgw1;
       wgw1.resize(200);
       cout << "wgw1 size is :" << wgw1.size()<<l;
       cout << "wgw1 capacity is:" << wgw1.capacity() <<l;
       getchar();
       return 0;
【OpenCV:resize函数 VS vector:resize函数】}

OpenCV:resize函数 VS vector:resize函数

文章插图

注重事项【注】:若是n年夜于当前的vector的容量(是容量 , 并非vector的size) , 将会引起主动内存分派 , 所以现有的pointer,references,iterators将会掉效 。

以上内容就是OpenCV:resize函数 VS vector:resize函数的内容啦 , 希望对你有所帮助哦!

推荐阅读