Fork me on GitHub
上一页 1 ··· 81 82 83 84 85 86 87 88 89 ··· 119 下一页
摘要: 基础数据类型所占字节数: ishort int:2 int:4 long:8 float:4 double:8 char:1 阅读全文
posted @ 2019-12-29 15:03 西西嘛呦 阅读(174) 评论(0) 推荐(0)
摘要: set_intersection:求两个容器的交集 set_union:求两个集合的并集 set_difference:求两个集合的差集 1.set_intersection #include<iostream> using namespace std; #include <vector> #inc 阅读全文
posted @ 2019-12-29 13:28 西西嘛呦 阅读(852) 评论(0) 推荐(0)
摘要: accumulate:计算容器元素累计总和 fill:向容器中添加元素 1.accumulate #include<iostream> using namespace std; #include <vector> #include <numeric> //常用算术生成算法 void test01() 阅读全文
posted @ 2019-12-29 13:24 西西嘛呦 阅读(211) 评论(0) 推荐(0)
摘要: copy:容器中指定元素拷贝到另一容器中 replace:将容器内指定范围内的旧元素改为新元素 replace_if:容器内指定范围为满足条件的元素替换为新元素 swap:互换两个容器的元素 1.copy #include<iostream> using namespace std; #includ 阅读全文
posted @ 2019-12-29 13:21 西西嘛呦 阅读(294) 评论(0) 推荐(0)
摘要: sort:对容器元素进行排序 random_shuffle:洗牌,指定范围内的元素随机调整次序 merge:容器元素合并,并存储到另一容器中 reverse:反转指定范围内的元素 1.sort #include<iostream> using namespace std; #include <alg 阅读全文
posted @ 2019-12-29 13:17 西西嘛呦 阅读(509) 评论(0) 推荐(0)
摘要: 引入#include<algorithm> 算法简介: find:查找元素 find_if:按条件查找 adjacent_find:查找相邻房重复的元素 binary_search:二分查找 count:统计元素个数 count_if:按条件统计元素个数 1.find #include<iostre 阅读全文
posted @ 2019-12-29 13:12 西西嘛呦 阅读(844) 评论(0) 推荐(0)
摘要: 需要引入头文件#include<algorithm> 1.for_each #include<iostream> using namespace std; #include <vector> #include <algorithm> class MyPrint { public: void oper 阅读全文
posted @ 2019-12-29 13:02 西西嘛呦 阅读(482) 评论(0) 推荐(0)
摘要: STL内建了一些函数对象:算数仿函数、关系仿函数、逻辑仿函数 用法: 这些仿函数所产生的对象,用法和一般函数完全相同; 使用內建函数对象,需要引入头文件#<include><functional> 一、算数仿函数 #include<iostream> using namespace std; #in 阅读全文
posted @ 2019-12-28 17:44 西西嘛呦 阅读(266) 评论(0) 推荐(0)
摘要: 概念: 返回bool类型的仿函数被称为谓词; 如果operator()接受一个参数,那么就叫一元谓词; 如果operator()接受两个参数,那么就叫二元谓词; 一、一元谓词 #include<iostream> using namespace std; #include <vector> #inc 阅读全文
posted @ 2019-12-28 17:19 西西嘛呦 阅读(290) 评论(0) 推荐(0)
摘要: 概念: 重载函数调用操作符的类, 其对象被称为函数对象; 函数对象使用重载的()时,行为类似函数调用,也叫仿函数; 本质:函数对象是一个类,不是一个函数; 函数对象使用: - 函数对象在使用时,可以像普通函数那样调用, 可以有参数,可以有返回值- 函数对象超出普通函数的概念,函数对象可以有自己的状态 阅读全文
posted @ 2019-12-28 17:14 西西嘛呦 阅读(366) 评论(0) 推荐(0)
上一页 1 ··· 81 82 83 84 85 86 87 88 89 ··· 119 下一页