C++之STL
灿烂的人生
此时的我开始感到不安,oo唔oo!只想更加的充实自己,走向辉煌
展开
-
函数适配器
1.初识函数适配器 1)使用bind2nd进行绑定 2)需要继承 public binary_function<参数类型1,参数类型2,返回值类型> 3)使用const修饰operator() class myPrint:public binary_function<int,int,void> { public: void operator()(int val,int s...原创 2020-03-21 21:53:52 · 139 阅读 · 0 评论 -
STL-multimap容器示例
题目要求://公司今天招聘5个员工,5名员工进入公司之后,需要指派员工在那个部门工作人员信息有:姓名,年龄,电话和工资等组成,通过multimap进行信息的插入保存和显示分部门显示员工信息。 #include<iostream> #include<map> #include<string> #include<vector> #include<s...原创 2020-03-20 20:48:00 · 84 阅读 · 0 评论 -
STL一些常用容器的特点
0.vector:link 1.deque:link 2.stack:先进后出,遍历不提供迭代器,也不支持随机访问 不能遍历,只能通过从栈顶弹出元素link stack<int>s1; while(!s1.empty()) { cout<<s1.top()<<" "; s1.pop(); } cout<<endl; 3.queue队列先进先出,...原创 2020-03-18 21:35:57 · 278 阅读 · 0 评论 -
STL之set容器和pair容器
具体关于set容器和pair容器的理论自行查询度娘即可,以下代码仅仅是一些关于set和pair容器一些简单的API操作。 #include<iostream> #include<set> #include<string> using namespace std; void test01() { set<int>s1; s1.insert(7)...原创 2020-03-18 20:40:38 · 340 阅读 · 0 评论