当前位置:网站首页>vector 基础
vector 基础
2022-07-21 17:58:00 【浩海紫冰】
vector的遍历一般使用迭代器
int arr[]={
1,2,3,4........};
vector< int > ivec(begin(arr),end(arr));
for(auto it=ivec.begin();it!= ivec.end();++it)
- 1
或者采用
int arr[]={
1,2,3,4........};
vector< int > ivec(begin(arr),end(arr));
vector<int>::iterator it;
还可以for_each来遍历vector形式,如下:
int arr[]={
1,2,3,4........};
vector< int > ivec(begin(arr),end(arr));
for_each(ivec.begin(),ivec.end(),printf);
它还可以像数组一样去遍历
int arr[]={
1,2,3,4};
vector< int > ivec(begin(arr),end(arr));
for(decltype(ivec.size()) i=0;i<4;++i)
std::unordered_map 无序哈希
unordered_map<Key,T>::iterator it;
(*it).first; // the key value (of type Key)
(*it).second; // the mapped value (of type T)
(*it); // the "element value" (of type pair<const Key,T>)
边栏推荐
猜你喜欢
Pointer of C language (4)
Literature: Axure (brief introduction)
1978-2021中国统计年鉴、2003-2019(省、市面板数据)、1999-2019(县域面板数据)
Configuration de l'installation mysql - version 8.0 - Windows
文献:案例《电影排行榜》
Municipalités locales - importations, exportations et balance commerciale (2000 - 2020)
Educational structure and calculated average years of education from 1989 to 2020
jupyter notebook中切换虚拟环境
数学运算
SQL injection
随机推荐
odoo-js-doAction详解
Vocabulary of CET-4
How to quickly develop a simple and practical MES system?
Leetcode342:4 power
实测 11 款远程视频会议软件,宅家工作也能如丝般顺滑
嵌入式之网络问题总结(网卡丢包、网卡无法识别)
Small game cases of aircraft dodging bullets
hdparm
CAN通信协议(一)
Leetcode703: the k-th element in data flow
Mvcc multi version concurrency control for MySQL learning
文献:案例《电影排行榜》
队列(堆栈)
数千万数据量:2000-2019全中国省、市、县企业注册数据经纬度、注册数目等多指标信息
Bitmap of redis principle
飞机躲子弹小游戏案例
MySQL安装配置-8.0版-Windows
正则表达式的表示及基本应用
SQL注入
Docker系列 六. Docker 安装 Redis