当前位置:网站首页>【第14节 STL容器二】
【第14节 STL容器二】
2022-06-10 15:32:00 【qq_24409999】
双向链表
- list
#include <iostream>
#include <list>
#include<string>
using namespace std;
void testList()
{
list<int> iNum;
list<string> strNum;
//插入
strNum.push_back("string1");
strNum.push_back("string2");
strNum.push_front("string3");
//string3 string1 string2
//遍历
//不删除方式遍历
list<string>::iterator iter;
for (iter = strNum.begin(); iter != strNum.end(); iter++)
{
cout << *iter << "";
}
cout << endl;
cout << "是否为空:" << boolalpha << !strNum.empty() << endl;
cout << "元素个数:" << strNum.size() << endl;
//删除方式遍历
//string3 string1 string2
while ( !strNum.empty())
{
cout << strNum.front() << ""; //back()
strNum.pop_front();//头部删除 pop_front();
}
cout << endl;
cout << "元素个数:" << strNum.size() << endl;
}
int main()
{
testList();
return 0;
}
结果
string3string1string2
是否为空:true
元素个数:3
string3string1string2
元素个数:0
栈
- stack
队列
- queue/deque/priority_queue
集合
- set/multiset/bitset
边栏推荐
- Several reasons and solutions of virtual machine Ping failure
- C # game prototype character map dual movement
- Jiabo gp2120tu label printer installation and use tutorial (PC)
- ORB_ Slam2 visual inertial tight coupling positioning technology route and code explanation 0 - overall framework and theoretical basic knowledge
- 港大、英伟达 | Factuality Enhanced Language Models for Open-Ended Text Generation(用于开放式文本生成的事实性增强语言模型)
- Guanghetong high computing power intelligent module injects intelligence into 5g c-v2x in the trillion market
- Sorting and paging
- VINS理论与代码详解4——初始化
- How to open an account for agricultural futures? Are there any financial conditions?
- Software intelligence: formal rules of AAAS system metrics and grammars
猜你喜欢

Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
CAP 6.1 版本发布通告

姿态估计之2D人体姿态估计 - Associative Embedding: End-to-End Learning for Joint Detection and Grouping

ORB_SLAM2视觉惯性紧耦合定位技术路线与代码详解2——IMU初始化

姿态估计之2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)

2290. Minimum Obstacle Removal to Reach Corner

影刀RPA学习和遇见excel部分问题解决方式

Anti "internal roll", it is said that 360 enterprise security cloud will launch the "one click forced off duty" function, and the computer will automatically close the office software

Recommend an easy-to-use designer navigation website

Scope and closure
随机推荐
How to open an account for agricultural futures? Are there any financial conditions?
点投影到平面上的方法总结
How to write a global notice component?
CentOS Linux is dead! Oracle Linux may be a better alternative
凸函数的Hessian矩阵与高斯牛顿下降法增量矩阵半正定性的理解
Save a window with a specific size, resolution, or background color
MapReduce之Reduce阶段的join操作案例
【MySQL基础】
Guanghetong high computing power intelligent module injects intelligence into 5g c-v2x in the trillion market
ORB_ Slam2 visual inertial tight coupling positioning technology route and code explanation 2 - IMU initialization
The power of insight
RK3308 按键Key与LED灯
Solution to some problems of shadow knife RPA learning and meeting Excel
MapReduce案例之多Map阶段求共同好友
VINS理论与代码详解4——初始化
数字化管理中台+低代码,JNPF开启企业数字化转型的新引擎
Click to unlock "keyword" of guanghetong 5g module
[rust daily] 2022-04-19 performance evaluation of rust asynchronous framework
运行mapreduce任务缺失setJarByClass()报错找不到类
MapReduce案例之聚合求和