摘要: 1.查找算法 find: 区间查找 find_first_of: 查找区间第一次出现 adjacent_find: 查找第一次重复的数 search: 子序列查找 search_n: 子序列查找出现次数 count: 区间统计 count_if: 条件统计 equal: 比较 有序查找: binar 阅读全文
posted @ 2021-09-10 21:34 Creature_lurk 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1.lambda表达式 /* Lambda表达式: 匿名函数 最终得到的结果是一个函数指针 产生函数指针的同时,对应的函数也已经定义好 No.1 Lambda表达式的组成部分 [捕获方式](函数参数) mutable exception ->函数返回值{ 函数体;} 捕获方式: []: 不捕获任何变 阅读全文
posted @ 2021-09-10 19:32 Creature_lurk 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 1.仿函数 /* 仿函数:让类的对象模仿函数调用的行为(函数名()) //对象() 关键点在于重载() 仿函数一般来说用来做比较准则 充当for_each的参数 No.1 自己写仿函数 */ class Sum { public: int operator()(const int a, const 阅读全文
posted @ 2021-09-10 19:29 Creature_lurk 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1.迭代器 迭代器:可以说是一种访问容器的一个桥梁,类中类的一个对象,去模仿指针的行为 迭代器分类: 按照定义方式分类: + 正向迭代器: + 容器名::iterator iter; + begin(); + end(); + 常量正向迭代器 + 容器名::const_iterator citer 阅读全文
posted @ 2021-09-10 19:23 Creature_lurk 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 1.initalizer_list(列表) template <class _Ty> class MyVector { public: MyVector(int size) :curSize(0) { dataMemory = new _Ty[size]; } MyVector(initialize 阅读全文
posted @ 2021-09-10 19:04 Creature_lurk 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 1.tuple /* 可变参模板类 参数个数、数据类型不限定 */ void testCreateTuple() { //正常创建 tuple<int, string, double, float, int> tup1; tuple<int, string, string, double> tup2 阅读全文
posted @ 2021-09-10 18:58 Creature_lurk 阅读(26) 评论(0) 推荐(0) 编辑