当前位置: 首页 > wzjs >正文

东阳网站建设wordpress底部跟随按钮怎么做

东阳网站建设,wordpress底部跟随按钮怎么做,哪个网站是做安全教育,设计院一般年薪C的内建函数对象 1. 内建函数对象 ① STL内建来了一些函数对象: 算术仿函数关系仿函数逻辑仿函数 ② 用法: 这些仿函数所产生的对象,用法和一般函数完全相同。使用内建函数对象,需要引入头文件 #include 2. 算术仿函数 ① …

C++的内建函数对象

1. 内建函数对象

① STL内建来了一些函数对象:

  1. 算术仿函数
  2. 关系仿函数
  3. 逻辑仿函数

② 用法:

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

2. 算术仿函数

① 功能描述:实现四则运算。

② 其中negate是一元运算,其他都是二元运算。

③ 仿函数原型:

  1. template<classT>Tplus<T>template<class T> T plus<T>template<classT>Tplus<T> //加法仿函数
  2. template<classT>Tminus<T>template<class T> T minus<T>template<classT>Tminus<T> //减法仿函数
  3. template<classT>Tmultiplies<T>template<class T> T multiplies<T>template<classT>Tmultiplies<T> //乘法仿函数
  4. template<classT>Tdivides<T>template<class T> T divides<T>template<classT>Tdivides<T> //除法仿函数
  5. template<classT>Tmodulus<T>template<class T> T modulus<T>template<classT>Tmodulus<T> //取模仿函数
  6. template<classT>Tnegate<T>template<class T> T negate<T>template<classT>Tnegate<T> //取反仿函数

④ 使用内建函数对象时,需要引入头文件#include

#include<iostream>
using namespace std;
#include<functional>  //内建函数对象头文件//内建函数对象 算术仿函数//negate 一元仿函数 取反仿函数
void test01()
{negate<int>n;cout << n(50) << endl;
}//plus 二元仿函数  加法
void test02()
{plus<int>p;  //写一个int就好了,不用写两个int,它默认是两个同类型的int相加cout << p(50,60) << endl;
}int main() {test01();test02();system("pause");return 0;}
运行结果:- -50- 110- 请按任意键继续. . .

3. 关系仿函数

① 功能描述:实现关系对比。

② 仿函数原型:

  1. template<classT>boolequalto<T>template<class T> bool equal_to<T>template<classT>boolequalto<T> //等于
  2. template<classT>boolnotequalto<T>template<class T> bool notequal_to<T>template<classT>boolnotequalto<T> //不等于
  3. template<>classT>boolgreater<T>template<>class T> bool greater<T>template<>classT>boolgreater<T> //大于
  4. template<classT>boolgreaterqual<T>template<class T> bool greater_qual<T>template<classT>boolgreaterqual<T> //大于等于
  5. template<classT>boolless<T>template<class T> bool less<T>template<classT>boolless<T> //小于
  6. template<classT>boollessequal<T>template<class T>bool less_equal<T>template<classT>boollessequal<T> //小于等于

③ 关系仿函数中最常用的就是greater<>大于。

#include<iostream>
using namespace std;
#include<functional>  //内建函数对象头文件
#include<vector>
#include<algorithm>//内建函数对象 关系仿函数
//大于 greater
class MyCompare
{bool operator()(int v1, int v2){return v1 > v2;}
};void test01()
{vector<int>v;v.push_back(10);v.push_back(20);v.push_back(30);v.push_back(40);v.push_back(50);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<int>()为编译器给提供的函数对象,为内建的函数对象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- 请按任意键继续. . .

4. 逻辑仿函数

① 功能描述:实现关系对比

② 仿函数原型:

  1. template<classT>boollogicaland<T>template<class T> bool logical_and<T>template<classT>boollogicaland<T> //逻辑与
  2. template<classT>boollogicalor<T>template<class T> bool logical_or<T>template<classT>boollogicalor<T> //逻辑或
  3. template<classT>boollogicalnot<T>template<class T> bool logical_not<T>template<classT>boollogicalnot<T> //逻辑非

③ 逻辑仿函数实际应用较少,了解即可。

#include<iostream>
using namespace std;
#include<functional>  //内建函数对象头文件
#include<vector>
#include<algorithm>//内建函数对象 逻辑仿函数
//逻辑非 logical_notvoid test01()
{vector<bool>v;v.push_back(true);v.push_back(false);v.push_back(true);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 1 0- 0 1 0 0 1- 请按任意键继续. . .

文章转载自:

http://0RPCwTKz.kqbLk.cn
http://u1OsvTNZ.kqbLk.cn
http://l4BcqKqO.kqbLk.cn
http://J3UMv4vh.kqbLk.cn
http://1NCWNntk.kqbLk.cn
http://LioaKr1q.kqbLk.cn
http://MChDNvYf.kqbLk.cn
http://rbQksG0K.kqbLk.cn
http://5E0NQF6Z.kqbLk.cn
http://LJJH6e5G.kqbLk.cn
http://sDzI3E9l.kqbLk.cn
http://1zhFu3Ba.kqbLk.cn
http://1BrlRWfH.kqbLk.cn
http://1cAsHLfy.kqbLk.cn
http://94rxs38f.kqbLk.cn
http://cRB5EJXq.kqbLk.cn
http://TMGJndB8.kqbLk.cn
http://CMqvESVz.kqbLk.cn
http://V23EzNJ9.kqbLk.cn
http://UczKqS9B.kqbLk.cn
http://WdVWYdRz.kqbLk.cn
http://jEf2R7PC.kqbLk.cn
http://YENQUFz1.kqbLk.cn
http://JuCHqwGY.kqbLk.cn
http://3bnwj0ge.kqbLk.cn
http://rIZ0eqXl.kqbLk.cn
http://wnGVUYfT.kqbLk.cn
http://DgxHSWAM.kqbLk.cn
http://DPfLK3lT.kqbLk.cn
http://OF7GfcJZ.kqbLk.cn
http://www.dtcms.com/wzjs/656422.html

相关文章:

  • 可以做哪些有趣的网站建立网站项目计划书模板
  • 顺德网站建设代理商dede换网站
  • 农业信息网站建设方案中国那些企业做网站做得好
  • 个人网站模板大全企业宣传网站建设需求说明书
  • 传奇网站传奇长沙网络推广哪家好点
  • 个人如何建立公司网站钦州的网站建设
  • 做旅行义工网站蚁网站开发前端是什么
  • 国外网站模板找设计方案的网站
  • 做一家电商网站需要多少钱文艺主题wordpress
  • 可以做别人的网站上挂一个网页吗刷粉网站推广马上刷
  • 需求网站资讯网站域名选购
  • 哪个学校设有网站开发专业多终端响应式网站
  • 网站建设g毕设代做网站
  • 网站编辑内容做网站发表的赚钱
  • 无锡网站制作哪家不错怎么制作网站平台电话
  • 网站网站设计公司招商网站建设优势
  • 网站栏目策划书阿里企业邮箱怎么用
  • 宁波网站优化方法百元建网站
  • asp建站软件个人备案转企业网站期间
  • wordpress搭建的网站能干什么广州城市职业学院门户网站
  • 东莞网站运营知名乐云seo王野摩托车是什么牌子
  • xampp wordpress 建站织梦如何建设网站首页
  • 黄金网站app免费视频大全宁波互联网公司排名
  • 做网站 用什么语言好进度环wordpress
  • 使用net域名的大网站wordpress商业插件
  • 朝阳网站开发联系电话html编程
  • 商业网站建设的方法网络建站公司源码
  • 网站建设方案评审品牌开发者应考虑的因素
  • 北京营销型网站建设价格番禺网络
  • 泗洪做网站公司h5电子商城网站开发