上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: **算法简介:** - `copy` // 容器内指定范围的元素拷贝到另一容器中 - `replace` // 将容器内指定范围的旧元素修改为新元素 - `replace_if ` // 容器内指定范围满足条件的元素替换为新元素 - `swap` // 互换两个容器的元素 #### 5.4.1 co 阅读全文
posted @ 2021-09-29 21:24 健丽 阅读(31) 评论(0) 推荐(0) 编辑
摘要: **算法简介:** - `sort` //对容器内元素进行排序 - `random_shuffle` //洗牌 指定范围内的元素随机调整次序 - `merge ` // 容器元素合并,并存储到另一容器中 - `reverse` // 反转指定范围的元素 #### 5.3.1 sort **功能描述: 阅读全文
posted @ 2021-09-29 21:22 健丽 阅读(43) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<algorithm> #include<vector> void print01(int val) { cout << val << ""; } class print02 { public: void 阅读全文
posted @ 2021-09-29 15:14 健丽 阅读(27) 评论(0) 推荐(0) 编辑
摘要: ## 4 STL- 函数对象### 4.1 函数对象#### 4.1.1 函数对象概念**概念:*** 重载**函数调用操作符**的类,其对象常称为**函数对象*** **函数对象**使用重载的()时,行为类似函数调用,也叫**仿函数****本质:**函数对象(仿函数)是一个**类**,不是一个函数 阅读全文
posted @ 2021-09-28 21:17 健丽 阅读(28) 评论(0) 推荐(0) 编辑
摘要: ### 3.9 map/ multimap容器#### 3.9.1 map基本概念**简介:*** map中所有元素都是pair* pair中第一个元素为key(键值),起到索引作用,第二个元素为value(实值)* 所有元素都会根据元素的键值自动排序**本质:*** map/multimap属于* 阅读全文
posted @ 2021-09-28 16:19 健丽 阅读(130) 评论(0) 推荐(0) 编辑
摘要: #include <set> void printSet(set<int> & s) { for (set<int>::iterator it = s.begin(); it != s.end(); it++) { cout << *it << " "; } cout << endl; } //构造 阅读全文
posted @ 2021-09-28 16:10 健丽 阅读(39) 评论(0) 推荐(0) 编辑
摘要: #include <list> void printList(const list<int>& L) { for (list<int>::const_iterator it = L.begin(); it != L.end(); it++) { cout << *it << " "; } cout 阅读全文
posted @ 2021-09-27 14:57 健丽 阅读(33) 评论(0) 推荐(0) 编辑
摘要: #include <queue> #include <string> class Person { public: Person(string name, int age) { this->m_Name = name; this->m_Age = age; } string m_Name; int 阅读全文
posted @ 2021-09-27 14:21 健丽 阅读(24) 评论(0) 推荐(0) 编辑
摘要: #include <stack> //栈容器常用接口 void test01() { //创建栈容器 栈容器必须符合先进后出 stack<int> s; //向栈中添加元素,叫做 压栈 入栈 s.push(10); s.push(20); s.push(30); while (!s.empty()) 阅读全文
posted @ 2021-09-27 09:35 健丽 阅读(43) 评论(0) 推荐(0) 编辑
摘要: #include <deque> void printDeque(const deque<int>& d) { for (deque<int>::const_iterator it = d.begin(); it != d.end(); it++) { cout << *it << " "; } c 阅读全文
posted @ 2021-09-27 09:12 健丽 阅读(35) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页