C++提高笔记(六)---STL函数对象、STL常用算法(遍历、查找)

1、STL-函数对象

1.1函数对象

1.1.1函数对象概念

概念:

重载函数调用操作符的类,其对象常称为函数对象

函数对象使用重载的()时,行为类似函数调用,也叫仿函数

本质:函数对象(仿函数)是一个,不是一个函数

1.1.2 函数对象使用

特点:

函数对象在使用时,可以像普通函数那样调用,可以有参数,可以有返回值

函数对象超出普通函数的概念,函数对象内部可以有自己的状态

函数对象可以作为参数传递

#include <iostream>
using namespace std;
#include<string>
//函数对象(仿函数)
//函数对象在使用时,可以像普通函数那样调用,可以有参数,可以有返回值
//函数对象超出普通函数的概念,函数对象内部可以有自己的状态
//函数对象可以作为参数传递
class MyAdd
{
public:int operator()(int v1, int v2){return v1 + v2;}
};
//1、函数对象在使用时,可以像普通函数那样调用,可以有参数,可以有返回值
void test01()
{MyAdd myadd;cout << myadd(10, 10) << endl;
}
//2、函数对象超出普通函数的概念,函数对象内部可以有自己的状态
class MyPrint
{
public:MyPrint(){this->count = 0;}void operator()(string text){cout << text << endl;this->count++;}int count;//内部自己状态
};
void test02()
{MyPrint myprint;myprint("hello world!");myprint("hello world!");myprint("hello world!");myprint("hello world!");cout << "MyPrint调用的次数:" << myprint.count << endl;
}
//3、函数对象可以作为参数传递
void doPrint(MyPrint& mp, string text)
{mp(text);
}
void test03()
{MyPrint myprint;doPrint(myprint, "hello C++");
}int main()
{test01();test02();test03();system("pause");return 0;
}

输出结果:

20
hello world!
hello world!
hello world!
hello world!
MyPrint调用的次数:4
hello C++
请按任意键继续. . .

1.2谓词

1.2.1谓词对象

概念:

        返回bool类型的仿函数称为谓词

        如果operator()接受一个参数,那么叫做一元谓词

        如果operator()接受二个参数,那么叫做二元谓词

1.2.2一元谓词

#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//仿函数 返回值类型是bool数据类型  称为谓词
//如果operator()接受一个参数,那么叫做一元谓词
class GreaterFive
{
public:bool operator()(int val){return val > 5;}
};void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//查找容器中 是否有大于5的数字//GreaterFive() 匿名函数对象vector<int>::iterator it = find_if(v.begin(), v.end(), GreaterFive());if (it == v.end()){cout << "未找到" << endl;}else{cout << "找到了大于5的数字为:" << *it << endl;}
}int main()
{test01();system("pause");return 0;
}

输出结果:

找到了大于5的数字为:6
请按任意键继续. . .

1.2.3二元谓词

#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//仿函数 返回值类型是bool数据类型  称为谓词
//二元谓词
class MyCompare
{
public:bool operator()(int v1,int v2){return v1 > v2;}
};void test01()
{vector<int>v;v.push_back(30);v.push_back(20);v.push_back(50);v.push_back(10);v.push_back(40);sort(v.begin(), v.end());//默认升序for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;//使用函数对象,改变算法策略,变为降序sort(v.begin(), v.end(), MyCompare());cout << "---------------------------" << endl;for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;
}int main()
{test01();system("pause");return 0;
}

输出结果:

10 20 30 40 50
---------------------------
50 40 30 20 10
请按任意键继续. . .

 1.3内建函数对象

1.3.1内建函数对象意义

概念:STL内建了一些函数对象

分类:
                算术仿函数
                关系仿函数
                逻辑仿函数

用法:这些仿函数所产生的对象,用法和一般函数完全相同。使用内建函数对象,需要引入头文件#include<functional>

1.3.2算术仿函数

功能描述:实现四则运算。其中negate是一元运算,其他都是二元运算

仿函数原型:

template<class T>T plus<T>       //加法仿函数
template<class T>T minus<T>      //减法仿函数
template<class T>T multiplies<T> //乘法仿函数
template<class T>T divides<T>    //除法仿函数
template<class T>T modulus<T>    //取模仿函数
template<class T>T negate<T>     //取反仿函数
#include <iostream>
using namespace std;
#include<functional>//内建函数对象头文件
//内建函数对象 算术仿函数
//template<class T>T plus<T>       //加法仿函数
//template<class T>T minus<T>      //减法仿函数
//template<class T>T multiplies<T> //乘法仿函数
//template<class T>T divides<T>    //除法仿函数
//template<class T>T modulus<T>    //取模仿函数
//template<class T>T negate<T>     //取反仿函数//negate 一元仿函数 取反仿函数
void test01()
{negate<int>n;cout << n(50) << endl;
}
//plus 二元仿函数 加法
void test02()
{plus<int>p;//默认传入同种数据类型,不能传入不同种数据类型cout << p(10, 20) << endl;
}
int main()
{test01();test02();system("pause");return 0;
}

输出结果:

-50
30
请按任意键继续. . .

1.3.3关系仿函数

功能描述:实现关系对比

仿函数原型:(最常用的是大于)

template<class T> bool equal_to<T>      //等于
template<class T> bool not_equal _to<T> //不等于
template<class T> bool greater<T>       //大于
template<class T> bool greater_equal<T> //大于等于
template<class T> bool less<T>          //小于
template<class T> bool less_equal<T>    //小于等于
#include <iostream>
using namespace std;
#include<functional>//内建函数对象头文件
#include<vector>
#include<algorithm>
//内建函数对象 关系仿函数
//template<class T> bool equal_to<T>      //等于
//template<class T> bool not_equal _to<T> //不等于
//template<class T> bool greater<T>       //大于
//template<class T> bool greater_equal<T> //大于等于
//template<class T> bool less<T>          //小于
//template<class T> bool less_equal<T>    //小于等于//大于 greater                
class MyCompare
{
public:bool operator()(int v1, int v2){return v1 > v2;}
};
void test01()
{vector<int>v;v.push_back(10);v.push_back(30);v.push_back(40);v.push_back(50);v.push_back(20);for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;//降序//sort(v.begin(), v.end(), MyCompare()); //自己重载仿函数sort(v.begin(), v.end(), greater<int>());//内建函数对象(仿函数)greater,效果一致for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;
}int main()
{test01();system("pause");return 0;
}

输出结果:

10 30 40 50 20
50 40 30 20 10
请按任意键继续. . .

1.3.4逻辑仿函数

功能描述:实现逻辑运算

函数原型:

template<class T> bool logical_and<T> //逻辑与
template<class T> bool 1ogical_or<T>  //逻辑或
template<class T> bool logical_not<T> //逻辑非
#include <iostream>
using namespace std;
#include<functional>//内建函数对象头文件
#include<vector>
#include<algorithm>
//内建函数对象 关系仿函数
//template<class T> bool logical_and<T> //逻辑与
//template<class T> bool 1ogical_or<T>  //逻辑或
//template<class T> bool logical_not<T> //逻辑非//逻辑非 logical_not                
void test01()
{vector<bool>v;v.push_back(true);v.push_back(false);v.push_back(true);v.push_back(false);for (vector<bool>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;//利用逻辑非,将容器v搬运到容器v2中,并执行取反的操作vector<bool>v2;v2.resize(v.size());transform(v.begin(), v.end(), v2.begin(), logical_not<bool>());for (vector<bool>::iterator it = v2.begin(); it != v2.end(); it++){cout << *it << " ";}cout << endl;
}int main()
{test01();system("pause");return 0;
}

输出结果:

1 0 1 0
0 1 0 1
请按任意键继续. . .

2、STL-常用算法

概述:

算法主要是由头文件<algorithm><functional><numeric>组成

<algorithm>是所有STL头文件中最大的一个,范围涉及到比较,交换,查找,遍历操作,复制,修改等

<numeric>体积很小,只包括几个在序列上面进行简单数学运算的模板函数

<functional>定义了一些模板类,用以声明函数对象

2.1 常用遍历算法

学习目标:掌握常用的遍历算法

算法简介:

for_each  //遍历容器
transform //搬运容器到另一个容器中

2.1.1 for_each

功能描述:实现遍历容器

函数原型:

for_each(iterator beg, iterator end, _func); 
// 遍历算法 遍历容器元素
// beg 开始迭代器
// end 结束迭代器
// _func函数或者函数对象
#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用遍历算法 for_each
//普通函数
void print01(int val)
{cout << val << " ";
}
//仿函数
class print02
{
public:void operator()(int val){cout << val << " ";}
};
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}for_each(v.begin(), v.end(), print01);//普通函数放函数名cout << endl;for_each(v.begin(), v.end(), print02());//仿函数要放函数对象,加()cout << endl;
}int main()
{test01();system("pause");return 0;
}

输出结果:

0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
请按任意键继续. . .

总结:for_each在实际开发中是最常用遍历方法,需要熟练掌握 

2.1.2 transform

功能描述:搬运容器到另一个容器中

函数原型:

transform(iterator begl,iterator end1,iterator beg2,_func);
//beg1 源容器开始迭代器
//end1 源容器结束迭代器
//beg2 目标容器开始迭代器
//_func 函数或者函数对象
#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用遍历算法 transform
//仿函数
class Transform
{
public:int operator()(int v){return v + 10;}
};class MyPrint
{
public:void operator()(int v){cout << v << " ";}
};void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}vector<int>vTarget;//目标容器vTarget.resize(v.size());//目标容器 需要提前开辟空间,否则搬运不成功transform(v.begin(), v.end(), vTarget.begin(), Transform());//可以在最后一个函数对搬运的数据进行运算或者改变 例如这次加10for_each(vTarget.begin(), vTarget.end(), MyPrint());//仿函数要放函数对象,加()cout << endl;
}int main()
{test01();system("pause");return 0;
}

输出结果:

10 11 12 13 14 15 16 17 18 19
请按任意键继续. . .

2.2常用查找算法

学习目标:掌握常用的查找算法

算法简介:

find          //查找元素
find_if       //按条件查找元素
adjacent_find //查找相邻重复元素
binary_search //二分查找法
count         //统计元素个数
count_if      //按条件统计元素个数

2.2.1 find

功能描述:查找指定元素,找到返回指定元素的迭代器,找不到返回结束迭代器end()

函数原型:

find(iterator beg, iterator end, value);
// 按值查找元素,找到返回指定校置迭代器,找不到返回结束迭代器位置
// beg 开始迭代器
// end 结束迭代器
// value 查找的元素
#include <iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
//常用查找算法 find
//查找 内置数据类型
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}vector<int>::iterator pos = find(v.begin(), v.end(), 5);if (pos == v.end()){cout << "没有找到!" << endl;}else{cout << "找到:" << *pos << endl;}
}class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}//重载== 底层find知道如何对比Person数据类型bool operator==(const Person& p){if (this->m_Name == p.m_Name && this->m_Age == p.m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};//查找 自定义数据类型
void test02()
{vector<Person>v;//创建数据Person p1("aaa", 10);Person p2("bbb", 20);Person p3("ccc", 30);Person p4("ddd", 40);Person pp("bbb", 20);//查找有无与此人相同的人//放入到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);//查找vector<Person>::iterator pos = find(v.begin(), v.end(), pp);if (pos == v.end()){cout << "没有找到!" << endl;}else{cout << "找到此人 姓名:" << pos->m_Name << " 年龄:" << pos->m_Age << endl;}
}int main()
{test01();test02();system("pause");return 0;
}

输出结果:

找到:5
找到此人 姓名:bbb 年龄:20
请按任意键继续. . .

2.2.2 find_if

功能描述:按条件查找元素

函数原型:

find_if(iterator beg,iterator end,_Pred);
// 按值查找元素,找到返回指定位置选代器,找不到返回结束迭代器位置
// beg 开始迭代器
// end 结束迭代器
//_Pred 函数或者谓词(返回bool类型的仿函数)
#include <iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
//常用查找算法 find_if
//1、查找 内置数据类型
class GreaterFive
{
public:bool operator()(int val){return val > 5;}
};void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}vector<int>::iterator pos = find_if(v.begin(), v.end(), GreaterFive());if (pos == v.end()){cout << "没有找到!" << endl;}else{cout << "找到大于5的数字 为:" << *pos << endl;}
}class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}string m_Name;int m_Age;
};class Greater20
{
public:bool operator()(Person& p){return p.m_Age > 20;}
};//2、查找 自定义数据类型
void test02()
{vector<Person>v;//创建数据Person p1("aaa", 10);Person p2("bbb", 20);Person p3("ccc", 30);Person p4("ddd", 40);Person pp("bbb", 20);//查找有无与此人相同的人//放入到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);//查找年龄大于20的人vector<Person>::iterator pos = find_if(v.begin(), v.end(), Greater20());if (pos == v.end()){cout << "没有找到!" << endl;}else{cout << "找到此人 姓名:" << pos->m_Name << " 年龄:" << pos->m_Age << endl;}
}int main()
{test01();test02();system("pause");return 0;
}

输出结果:

找到大于5的数字 为:6
找到此人 姓名:ccc 年龄:30
请按任意键继续. . .

2.2.3 adjacent_find

功能描述:查找相邻重复元素

函数原型:

adjacent_find(iterator beg, iterator end);
// 查找相邻重复元素,返回相邻元素的第一个位置的选代器
// beg 开始迭代器
// end 结束迭代器
#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 adjacent_find
void test01()
{vector<int>v;v.push_back(0);v.push_back(2);v.push_back(0);v.push_back(3);v.push_back(1);v.push_back(4);v.push_back(3);v.push_back(3);vector<int>::iterator pos = adjacent_find(v.begin(), v.end());if (pos == v.end()){cout << "没有找到相邻重复元素!" << endl;}else{cout << "找到相邻重复元素:" << *pos << endl;}
}int main()
{test01();system("pause");return 0;
}

输出结果:

找到相邻重复元素:3
请按任意键继续. . .

2.2.4 binary_search

功能描述:查找指定元素是否存在  注意: 在无序序列中不可用

函数原型:

bool binary_search(iterator beg, iterator end, value);
// 查找指定的元素,查到返回true 否则false
// 注意: 在无序序列中不可用
// beg 开始迭代器
// end 结束迭代器
// value 查找的元素n
#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 binary_search
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//查找容器中是否有9 元素//注意: 在无序序列中不可用//如果是无序序列,结果未知//必须要有序bool ret = binary_search(v.begin(), v.end(), 9);if (ret){cout << "找到了元素!" << endl;}else{cout << "未找到!" << endl;}
}int main()
{test01();system("pause");return 0;
}

输出结果:

找到了元素!
请按任意键继续. . .

2.2.5 count

功能描述:统计元素个数

注意:统计自定义数据类型时,需要配合重载operator==

函数原型:

count(iterator beg, iterator end, value);
// 统计元素出现次数
// beg 开始迭代器
// end 结束迭代器
// value 统计的元素
#include <iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
//常用查找算法 count
//1、统计内置数据类型
void test01()
{vector<int>v;v.push_back(10);v.push_back(40);v.push_back(30);v.push_back(40);v.push_back(20);v.push_back(40);int num = count(v.begin(), v.end(), 40);cout << "40元素个数为:" << num << endl;
}
//2、统计自定义数据类型
class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}//需要加const,防止用户修改Person//否则会报错bool operator==(const Person& p){if (this->m_Age == p.m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};void test02()
{vector<Person>v;Person p1("刘备", 35);Person p2("关羽", 35);Person p3("张飞", 35);Person p4("赵云", 30);Person p5("曹操", 40);//将人员插入到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);v.push_back(p5);Person p("诸葛亮", 35);int num = count(v.begin(), v.end(), p);cout << "与诸葛亮同岁数的人员个数为:" << num << endl;
}int main()
{test01();test02();system("pause");return 0;
}

输出结果:

40元素个数为:3
与诸葛亮同岁数的人员个数为:3
请按任意键继续. . .

2.2.6 count_if

功能描述:按条件统计元素个数

函数原型:

count_if(iterator beg, iterator end, _pred);
// 按条件统计元素出现次数
// beg 开始迭代器
// end 结束迭代器
// _Pred 谓词
#include <iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
//常用查找算法 count_if
//1、统计内置数据类型
class Greater20
{
public:bool operator()(int val){return val > 20;}
};
void test01()
{vector<int>v;v.push_back(10);v.push_back(40);v.push_back(30);v.push_back(20);v.push_back(40);v.push_back(20);int num = count_if(v.begin(), v.end(), Greater20());cout << "大于20的元素个数为:" << num << endl;
}
//2、统计自定义数据类型
class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}//需要加const,防止用户修改Person//否则会报错bool operator==(const Person& p){if (this->m_Age == p.m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};class AgeGreater20
{
public:bool operator()(const Person& p){return p.m_Age > 20;}
};void test02()
{vector<Person>v;Person p1("刘备", 35);Person p2("关羽", 35);Person p3("张飞", 35);Person p4("赵云", 40);Person p5("曹操", 20);//将人员插入到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);v.push_back(p5);int num = count_if(v.begin(), v.end(), AgeGreater20());cout << "大于20岁的人员个数为:" << num << endl;
}int main()
{test01();test02();system("pause");return 0;
}

输出结果:

大于20的元素个数为:3
大于20岁的人员个数为:4
请按任意键继续. . .

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/754909.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux常用指令

前言 大家好我是jiantaoyab&#xff0c;这篇文章给大家介绍Linux下常用的命令。 指令的本质也是Linux上的一些程序。 cd cd - 回到最近从哪来的路径 cd ~ 当前用户对应的工作目录&#xff08;普通用户&#xff1a;/home/xx root用户&#xff1a;/root&#xff09; cd / 去…

C语言经典面试题目(十九)

1、什么是C语言&#xff1f;简要介绍一下其历史和特点。 C语言是一种通用的高级计算机编程语言&#xff0c;最初由贝尔实验室的Dennis Ritchie在1972年至1973年间设计和实现。C语言被广泛应用于系统编程、应用程序开发、嵌入式系统和操作系统等领域。它具有高效、灵活、可移植…

【vscode】vscode重命名变量后多了很多空白行

这种情况&#xff0c;一般出现在重新安装 vscode 后出现。 原因大概率是语言服务器没设置好或设置对。 以 Python 为例&#xff0c;到设置里搜索 "python.languageServer"&#xff0c;将 Python 的语言服务器设置为 Pylance 即可。

React全家桶及原理解析-lesson4-Redux

lesson4-react全家桶及原理解析.mov React全家桶及原理解析 React全家桶及原理解析 课堂⽬标资源起步Reducer 什么是reducer什么是reduceRedux 上⼿ 安装reduxredux上⼿检查点react-redux 异步代码抽取Redux拓展 redux原理 核⼼实现中间件实现redux-thunk原理react-redux原理 实…

AI和信号处理推荐书单

推荐AI书单 1、《动手学深度学习-pytorch版》 https://item.m.jd.com/product/10068173196371.html?utm_sourceiosapp&utm_mediumappshare&utm_campaignt_335139774&utm_termCopyURL&ad_odshare&gxRnAomTM2bWfQmswcp40mDrUkxA7sLkk&gxdRnAoymFZOTXe…

【数据可视化】Echarts官方文档及常用组件

个人主页 &#xff1a; zxctscl 如有转载请先通知 文章目录 1. 前言2. Echarts官方文档介绍3. ECharts基础架构及常用术语3.1 ECharts的基础架构3.2 ECharts的常用术语3.2.1 ECharts的基本名词3.2.2 ECharts的图表名词 4. 直角坐标系下的网格及坐标轴4.1 直角坐标系下的网格4.2…

关于BFF

BFF&#xff08;Backend For Frontend&#xff09;是一种架构设计模式&#xff0c;用于解决多端&#xff08;如Web、移动端等&#xff09;共用一个后端服务时的问题。BFF的主要目标是将前端与后端的业务逻辑分离&#xff0c;使得前端可以根据自身的需求定制接口和数据&#xff…

C++的语法

可能需要用到存储各种数据类型&#xff08;比如字符型、宽字符型、整型、浮点型、双浮点型、布尔型等&#xff09; 下表显示了各种变量类型在内存中存储值时需要占用的内存&#xff0c;以及该类型的变量所能存储的最大值和最小值。 注意&#xff1a;不同系统会有所差异 #inc…

CentOS7 操作firewall防火墙

常用命令 开启关闭防火墙 systemctl start/status/stop/disable firewalld查看默认区域名称 $ firewall-cmd --get-default-zone public查看区域信息 firewall-cmd --get-active-zones查看指定接口所属区域 firewall-cmd --get-zone-of-interfaceeth0查看防火墙配置 # 查…

Qt Excel文件读写

QAxObject是Qt框架中用于与ActiveX控件和COM对象进行交互的类。它使得在Qt应用程序中嵌入和使用ActiveX控件&#xff0c;或者操作COM对象成为可能。通过QAxObject&#xff0c;你可以在Qt中方便地操作Excel、Word等Office应用程序&#xff0c;以及许多其他支持ActiveX或COM技术的…

AI人工智能小程序系统开发

开发AI人工智能小程序系统需要以下步骤&#xff1a; 1. 确定需求&#xff1a;了解客户对人工智能小程序的期望&#xff0c;并分析系统的实际应用场景。 2. 设计架构&#xff1a;选择合适的技术框架和人工智能算法&#xff0c;进行小程序系统架构的设计。 3. 数据采集和处理&…

诺视科技完成亿元Pre-A2轮融资,加速Micro-LED微显示芯片商业化落地

近日&#xff0c;Micro-LED微显示芯片研发商诺视科技&#xff08;苏州&#xff09;有限公司&#xff08;以下简称“诺视科技”&#xff09;宣布完成亿元Pre-A2轮融资&#xff0c;本轮融资由力合资本领投&#xff0c;老股东盛景嘉成、汕韩基金以及九合创投持续加码&#xff0c;这…

【漏洞复现】北京新网医讯技术有限公司云端客服管理系统存在SQL注入漏洞

免责声明&#xff1a;文章来源互联网收集整理&#xff0c;请勿利用文章内的相关技术从事非法测试&#xff0c;由于传播、利用此文所提供的信息或者工具而造成的任何直接或者间接的后果及损失&#xff0c;均由使用者本人负责&#xff0c;所产生的一切不良后果与文章作者无关。该…

【Linux】cat vim 命令存在着什么区别?

Linux 中的 cat 命令和 vim 命令之间存在一些显著的区别&#xff01; cat 命令 首先&#xff0c;cat命令主要用于连接并显示文件的内容。它的原含义是“连接&#xff08;concatenate&#xff09;”&#xff0c;可以将多个文件的内容连接起来&#xff0c;并输出到标准输出流中&…

python模块

模块导入方式 模块需要在使用前进行导入 语法&#xff1a;[from 模块名] import [ 模块 | 类 | 函数 | *] [ as 别名 ] * 代表全部将该模块全部导入 from 模块名 import 功能名 #导入时间模块中的sleep方法 from time import sleep 注意&#xff1a;from可以省略 直接…

python使用appium在指定的坐标位置点击

在Appium中&#xff0c;要在指定的坐标位置执行点击操作&#xff0c;你可以使用TouchAction类配合press和release方法。下面是一个简单的示例代码&#xff0c;展示了如何在指定的(x, y)坐标位置执行点击操作&#xff1a; from appium import webdriver from appium.webdriver.…

掘根宝典之C++正向迭代器和反向迭代器详解

简介 迭代器是一种用于遍历容器元素的对象。它提供了一种统一的访问方式&#xff0c;使程序员可以对容器中的元素进行逐个访问和操作&#xff0c;而不需要了解容器的内部实现细节。 C标准库里每个容器都定义了迭代器&#xff0c;这迭代器的名字就叫容器迭代器 迭代器的作用类…

java Flink(四十二)Flink的序列化以及TypeInformation介绍(源码分析)

Flink的TypeInformation以及序列化 TypeInformation主要作用是为了在 Flink系统内有效地对数据结构类型进行管理&#xff0c;能够在分布式计算过程中对数据的类型进行管理和推断。同时基于对数据的类型信息管理&#xff0c;Flink内部对数据存储也进行了相应的性能优化。 Flin…

php中 Serializable 接口详解

Serializable 是 PHP 中一个内置的接口&#xff0c;它为对象提供了自定义的序列化和反序列化能力。实现这个接口的类可以控制它们的序列化行为&#xff0c;即它们如何被序列化到字符串以及如何从字符串反序列化回对象。 当一个对象需要被存储或在网络间传输时&#xff0c;通常…

深入理解 C# Unity 中的事件和委托

事件和委托是 C# Unity 游戏开发中的基本概念,可实现游戏不同部分之间的通信和交互。在本文中,我们将以简单的术语探讨这些概念,以帮助Unity 项目中利用它们发挥应有的作用 目录 事件和委托: 1. 什么是 C# 事件? 2、声明: 3. 订阅活动: 4. 发布活动: 5.