当前位置:编程学习 > 网站相关 >>

自创测试小技巧之vector的显示

//#define showVector(T) for_each(T.begin(),T.end(),[](int i){cout<<i<<" ";});cout<<endl

#include <iostream>

#include <vector>
#include <algorithm>
#include <iterator>
#include <type_traits>
#include <memory>using namespace std;
#define showVector(T) for_each(T.
begin(),T.end(),[](int i){cout<<i<<" ";});
cout<<endlint main(){    vector<int> one(10);  
  vector<int> two(10);  
  for_each(one.begin(),one.end(),[](int& x){ x = 3;}); 
   showVector(one);   
uninitialized_copy(one.begin(),one.end(),two.begin()); 
   showVector(two);   
return 1;}

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,