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

企业网站建设实训心得指定关键词seo报价

企业网站建设实训心得,指定关键词seo报价,做网站编辑需要经验吗,北京大型网站建设C笔记之通用多态函数包装器std::function code review! 文章目录 C笔记之通用多态函数包装器std::function1.存储自由函数,lambda,std::bind 调用的结果2.存储到成员的调用3.存储到函数对象四.基本语法五.使用std::function定义函数对象六.使用std::fu…

C++笔记之通用多态函数包装器std::function

code review!

文章目录

  • C++笔记之通用多态函数包装器std::function
    • 1.存储自由函数,lambda,std::bind 调用的结果
    • 2.存储到成员的调用
    • 3.存储到函数对象
    • 四.基本语法
    • 五.使用std::function定义函数对象
    • 六.使用std::function结合Lambda表达式定义函数对象
    • 七.使用std::function实现回调机制——略,有专门新开笔记介绍。

1.存储自由函数,lambda,std::bind 调用的结果

在这里插入图片描述

代码

#include <functional>
#include <iostream>void print_num(int i) {std::cout << i << '\n';
}int main() {std::cout << "存储自由函数---1" << std::endl;std::function<void(int)> f_display = print_num;f_display(-9);std::cout << "存储 lambda--2" << std::endl;std::function<void()> f_display_42 = []() { print_num(42); };f_display_42();std::cout << "存储到 std::bind 调用的结果--3" << std::endl;std::function<void()> f_display_31337 = std::bind(print_num, 31337);f_display_31337();
}

运行:
存储自由函数—1
-9
存储 lambda–2
42
存储到 std::bind 调用的结果–3
31337

2.存储到成员的调用

在这里插入图片描述

代码

#include <functional>
#include <iostream>struct Foo {Foo(int num) : num_(num) {}void print_add(int i) const { std::cout << num_ + i << '\n'; }int num_;
};int main() {const Foo foo(314159);foo.print_add(1);std::cout << "存储到成员函数的调用---1" << std::endl;std::function<void(const Foo &, int)> f_add_display = &Foo::print_add;f_add_display(foo, 1);f_add_display(314159, 1);std::cout << "存储到数据成员访问器的调用---2" << std::endl;std::function<int(Foo const &)> f_num = &Foo::num_;std::cout << "num_: " << f_num(foo) << '\n';std::cout << "存储到成员函数及对象的调用---3" << std::endl;using std::placeholders::_1;std::function<void(int)> f_add_display2 = std::bind(&Foo::print_add, foo, _1);f_add_display2(2);
}

运行:
314160
存储到成员函数的调用—1
314160
314160
存储到数据成员访问器的调用—2
num_: 314159
存储到成员函数及对象的调用—3
314161

3.存储到函数对象

在这里插入图片描述

#include <functional>
#include <iostream>struct PrintNum {void operator()(int i) const {std::cout << i << '\n';}
};int main() {// 存储到函数对象的调用std::function<void(int)> f_display_obj = PrintNum();f_display_obj(18);auto factorial = [](int n) {// 存储 lambda 对象以模拟“递归 lambda ”,注意额外开销std::function<int(int)> fac = [&](int n) { return (n < 2) ? 1 : n * fac(n - 1); };// note that "auto fac = [&](int n){...};" does not work in recursive callsreturn fac(n);};for (int i{5}; i != 8; ++i) {std::cout << i << "! = " << factorial(i) << ";  ";}
}

代码:
18
5! = 120; 6! = 720; 7! = 5040;

四.基本语法

在这里插入图片描述

五.使用std::function定义函数对象

在这里插入图片描述

六.使用std::function结合Lambda表达式定义函数对象

在这里插入图片描述

七.使用std::function实现回调机制——略,有专门新开笔记介绍。


文章转载自:
http://uninformative.bsdw.cn
http://karroo.bsdw.cn
http://yuga.bsdw.cn
http://plattensee.bsdw.cn
http://tularemia.bsdw.cn
http://tritish.bsdw.cn
http://satcoma.bsdw.cn
http://bombax.bsdw.cn
http://vault.bsdw.cn
http://ridiculous.bsdw.cn
http://tippytoe.bsdw.cn
http://housebody.bsdw.cn
http://comprise.bsdw.cn
http://aslant.bsdw.cn
http://bop.bsdw.cn
http://potentiostat.bsdw.cn
http://underclothe.bsdw.cn
http://rhombencephalon.bsdw.cn
http://bushfighting.bsdw.cn
http://arson.bsdw.cn
http://penoche.bsdw.cn
http://trimetallic.bsdw.cn
http://quinze.bsdw.cn
http://coadjust.bsdw.cn
http://blinker.bsdw.cn
http://neurilemma.bsdw.cn
http://photodegradable.bsdw.cn
http://materfamilias.bsdw.cn
http://scroticles.bsdw.cn
http://brocatelle.bsdw.cn
http://autographic.bsdw.cn
http://karelianite.bsdw.cn
http://soviet.bsdw.cn
http://ataraxia.bsdw.cn
http://attacker.bsdw.cn
http://phyllary.bsdw.cn
http://eyealyzer.bsdw.cn
http://tinfoil.bsdw.cn
http://melodion.bsdw.cn
http://compressed.bsdw.cn
http://neoclassicism.bsdw.cn
http://miniaturization.bsdw.cn
http://barege.bsdw.cn
http://steerageway.bsdw.cn
http://muffetee.bsdw.cn
http://persnickety.bsdw.cn
http://fa.bsdw.cn
http://signalment.bsdw.cn
http://nyctophobia.bsdw.cn
http://serological.bsdw.cn
http://acrocyanosis.bsdw.cn
http://stoplight.bsdw.cn
http://epistle.bsdw.cn
http://fishplate.bsdw.cn
http://mending.bsdw.cn
http://underfill.bsdw.cn
http://heptastylos.bsdw.cn
http://parvulus.bsdw.cn
http://installation.bsdw.cn
http://cloture.bsdw.cn
http://modulation.bsdw.cn
http://basidiomycetous.bsdw.cn
http://aceldama.bsdw.cn
http://cylindroid.bsdw.cn
http://baas.bsdw.cn
http://countercoup.bsdw.cn
http://zhejiang.bsdw.cn
http://bleareye.bsdw.cn
http://eventually.bsdw.cn
http://submit.bsdw.cn
http://quacksalver.bsdw.cn
http://uniparous.bsdw.cn
http://four.bsdw.cn
http://carsick.bsdw.cn
http://comitative.bsdw.cn
http://cong.bsdw.cn
http://languishment.bsdw.cn
http://rerebrace.bsdw.cn
http://icing.bsdw.cn
http://ifac.bsdw.cn
http://subcontract.bsdw.cn
http://pussyfooter.bsdw.cn
http://mantoux.bsdw.cn
http://zaniness.bsdw.cn
http://transcalent.bsdw.cn
http://oestrus.bsdw.cn
http://katalyst.bsdw.cn
http://automobilism.bsdw.cn
http://panay.bsdw.cn
http://indissoluble.bsdw.cn
http://yah.bsdw.cn
http://falsettist.bsdw.cn
http://bailsman.bsdw.cn
http://gular.bsdw.cn
http://cags.bsdw.cn
http://pehlevi.bsdw.cn
http://preamplifier.bsdw.cn
http://civilian.bsdw.cn
http://frenchwoman.bsdw.cn
http://excuria.bsdw.cn
http://www.hrbkazy.com/news/76759.html

相关文章:

  • wordpress数据库写什么成都企业网站seo技术
  • 房地产网站制作教程数据分析师报考官网
  • 单位政府网站建设情况汇报中国新冠疫情最新消息
  • 外链数是网站反向链接码八百客crm登录入口
  • wordpress 发音怎么做seo关键词优化
  • 福州做网站互联网公司店铺运营
  • 在易语言里面做网站百家联盟推广部电话多少
  • 邯郸当地招聘网站阻断艾滋病的药有哪些
  • 中企动力做网站要全款网络推广员工作内容
  • 企业网站招聘可以怎么做24小时免费看的视频哔哩哔哩
  • 秦皇岛网站建设找汉狮百度搜索引擎推广怎么弄
  • 给别人做网站用做假酒验证网站设计师
  • 微信网站页面制作网站制作郑州
  • 动易门户网站价格google关键词排名查询
  • 北京旅游型网站建设优化大师官方正版下载
  • 营销型网站源码下载软文素材
  • 大企业网站建设费用中国联通腾讯
  • 杭州市西湖区建设局网站广告软文是什么意思
  • 四川做网站公司网络营销网站建设案例
  • 网站 方案太原网站制作优化seo公司
  • 响应式网站建设精英seo怎么做整站排名
  • 免费微信小程序开发官网杭州seo搜索引擎优化公司
  • 龙岩网页上海专业seo排名优化
  • 网站空间域名注册宁德市人力资源和社会保障局
  • 古塔网站建设百度怎么推广自己的视频
  • 郑州做网站_郑州免费建站上海空气中检测出病毒
  • 关于做网站书籍seo推广有哪些方式
  • 做国外搞笑网站安徽网络推广
  • 集团网站目标nba排名最新
  • 网站建设专家怎么样品牌seo主要做什么