刘大凡

G猪猪侠G

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2023年3月9日

摘要: 功能描述: 查找指定元素,找到返回指定元素的迭代器,找不到返回结束迭代器end() #include<iostream> #include<vector> #include<functional> #include<algorithm> #include<string> using namespac 阅读全文
posted @ 2023-03-09 23:43 G猪猪侠G 阅读(46) 评论(0) 推荐(0)

摘要: 功能: 将容器搬运到另一个容器 #include<iostream> #include<vector> #include<functional> #include<algorithm> using namespace std; //遍历函数 transform class Transform { p 阅读全文
posted @ 2023-03-09 18:56 G猪猪侠G 阅读(44) 评论(0) 推荐(0)

摘要: #include<iostream> #include<vector> #include<functional> #include<algorithm> using namespace std; //遍历函数 for_each //普通函数 void print1(int val) { cout < 阅读全文
posted @ 2023-03-09 18:46 G猪猪侠G 阅读(56) 评论(0) 推荐(0)

摘要: 功能: 实现逻辑运算 #include<iostream> #include<vector> #include<functional> #include<algorithm> using namespace std; //逻辑仿函数 //逻辑非 logical_not void test1() { 阅读全文
posted @ 2023-03-09 18:40 G猪猪侠G 阅读(24) 评论(0) 推荐(0)

摘要: 功能: 实现关系对比 1 #include<iostream> 2 #include<vector> 3 #include<functional> 4 #include<algorithm> 5 using namespace std; 6 //关系仿函数 7 8 //greater大于 9 voi 阅读全文
posted @ 2023-03-09 16:55 G猪猪侠G 阅读(19) 评论(0) 推荐(0)

摘要: 概念: STL内建了一些函数对象 分类: 算数仿函数 关系仿函数 逻辑仿函数 用法: 这些仿函数所产生的对象,用法和一般函数完全相同 使用内建函数对象,需要引入头文件 #include<functional> 算数仿函数 功能: 是实现四则运算 其中negate是一元运算,其他都是二元运算 #inc 阅读全文
posted @ 2023-03-09 16:15 G猪猪侠G 阅读(32) 评论(0) 推荐(0)

摘要: 1 #include<iostream> 2 #include<vector> 3 #include<algorithm> 4 5 using namespace std; 6 //二元谓词 7 class mycompare 8 { 9 public: 10 bool operator()(int 阅读全文
posted @ 2023-03-09 15:15 G猪猪侠G 阅读(48) 评论(0) 推荐(0)