当前位置:网站首页>STL 函数用法持续更新
STL 函数用法持续更新
2022-04-21 11:29:00 【.Ashy.】
map映射
map<string,string>mp;
1.遍历
for(auto k : mp)
k.first//键
k.second//值
2,头部迭代器
mp.begin()//返回指向map头部的迭代器
3.尾部迭代器
mp.end()//返回指向map末尾的迭代器
4.清除
mp.clear()//删除所有元素
5.计数
mp.count()//返回指定元素出现的次数,一键一值,所以count也用来查找
6.判空
mp.empty()//如果map为空返回0,否则返回1
7.查找
mp.find()//返回查找元素所在的迭代器,找不到返回mp.end();
8.二分
mp.lower_bound()//返回键值>=给定元素的第一个位置
mp.upper_bound()//返回键值>给定元素的第一个位置
9,大小
mp.size()//返回map中元素的个数
10.交换
swap()//交换两个map
string 字符串
string s1;
1.查找s2
s1.find(s2);//找到返回在s1中出现的下标,下标从0开始,找不到返回string::npos
vector 动态数组
1.比较大小
两个动态数组可以比较大小,比较规则与比较字符串字典序规则相似
set 集合
set<int>se;
1.插入
se.insert();
2.查找
se.count();//找到返回1,找不到返回0
版权声明
本文为[.Ashy.]所创,转载请带上原文链接,感谢
https://blog.csdn.net/woshilichunyang/article/details/124161013
边栏推荐
猜你喜欢

Redis集群模式

阅读材料:信息技术年谱

微信小程序转uniapp

塔米狗知识|股权转让合法程序有哪些?

Internet News: tuojing technology successfully landed on the science and innovation board; Jimi h3s and z6x Pro continue to sell well; HEMA launches "mobile supermarket" in Shanghai

互联网快讯:拓荆科技成功登陆科创板;极米H3S、极米Z6X Pro持续热销;盒马在上海启动“流动超市”

Haiwell Cloud Scada Designer 3

redis面试问题

实现浏览器多标签页通信

Three years of product manager, from 5K to 30K, I grew up like this (Part 1)
随机推荐
Solution | fast intercom dispatching system: efficient cooperation
I need to write two interfaces to receive data, and then store the data in the database to complete data persistence
54000 stars all return to zero. Project Author: I regret it very much
How does the webmaster prevent the website from being hacked
Three years of product manager, from 5K to 30K, I grew up like this (Part 1)
El expression
Dapr 远程调试之 Nocalhost
Analyze the future development direction of GPU
I18N internationalization
2. Precision marketing practice Alibaba cloud odpscmd data feature project
When you open the app, "you need to use a new app to open this MS gamingoverlay link"
Matlab GUI application - lottery (animation demonstration)
阅读材料:信息技术年谱
把数组字典写入csv格式
package. json
NCURSES 安装包,以及pkg-config信息
Path theme -- difference between server and browser
Xinghan will become the co construction unit of finops industry promotion matrix in the future
UNIX philosophy and high concurrency
MQ相关流程及各项内容