当前位置:网站首页>STL function usage is continuously updated
STL function usage is continuously updated
2022-04-21 11:31:00 【.Ashy.】
map mapping
map<string,string>mp;
1. Traverse
for(auto k : mp)
k.first// key
k.second// value
2, Head iterator
mp.begin()// Return to point map The iterator of the head
3. Tail iterator
mp.end()// Return to point map Iterator at the end
4. eliminate
mp.clear()// Delete all elements
5. Count
mp.count()// Returns the number of occurrences of the specified element , One key one value , therefore count Also used to find
6. Sentenced to empty
mp.empty()// If map Empty return 0, Otherwise return to 1
7. lookup
mp.find()// Returns the iterator that finds the element , No return found mp.end();
8. Two points
mp.lower_bound()// Return key value >= Given the first position of the element
mp.upper_bound()// Return key value > Given the first position of the element
9, size
mp.size()// return map The number of elements in
10. In exchange for
swap()// Two exchanges map
string character string
string s1;
1. lookup s2
s1.find(s2);// Find return in s1 Subscripts appearing in , Subscript from 0 Start , No return found string::npos
vector The dynamic array
1. Compare the size
Two dynamic arrays can compare sizes , The comparison rule is similar to the comparison string dictionary order rule
set aggregate
set<int>se;
1. Insert
se.insert();
2. lookup
se.count();// Found return 1, No return found 0
版权声明
本文为[.Ashy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211129320955.html
边栏推荐
- Redis cluster mode
- Digital IT operation from the perspective of thinking transformation
- 路径专题--服务器与浏览器区别
- [二叉数]对称二叉树
- How to carry cookies in cross domain requests?
- pycharm中归一化记录
- Normalized records in pycharm
- 华为、海尔智家、小米都在做的全屋智能,全在哪?
- Unix哲学与高并发
- Xinghan will become the co construction unit of finops industry promotion matrix in the future
猜你喜欢
随机推荐
Introduction to Alibaba's super large-scale Flink cluster operation and maintenance system
sentinelsat包介绍
InfoQ settled Express
UNIX philosophy and high concurrency
Haiwell Cloud Scada Designer 3
Redis集群模式
Unix哲学与高并发
实现浏览器多标签页通信
3年产品经理,从5k到30k,我是这样成长的(上)
Huisheng Huiying 2022 releases 8 new features of Huisheng Huiying 2022 (official)
星汉未来成为FinOps产业推进方阵共建单位
InfoQ 入驻快讯
Conversion between localdate, localdatetime and date
2.精准营销实践阿里云odpscmd数据特征工程.
Who developed the app pop-up function?
美国加息人民币贬值,这类产品却迎来蜜月期
Share 7 differences between map objects and ordinary objects
从B站和小红书看,如何做好社区产品?
Interpretation of tamigou project | 100% equity transfer of Hainan outlets Tourism Development Co., Ltd
星汉未来云原生基础治理平台SchedulX V1.1.0 重磅发布,助力企业降本增效







