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

如何制作网站效果图做网站一定要域名嘛

如何制作网站效果图,做网站一定要域名嘛,九游手游平台app,中国职业球队什么是emplace_back emplace_back是C11引入的STL容器成员函数。emplace操作只执行构造而不执行拷贝构造。 如何理解上面这句话#xff1f;先来看一个场景。 class test { public:test(){}test(int i){ std::cout test(int i) std::endl; }tes…什么是emplace_back emplace_back是C11引入的STL容器成员函数。emplace操作只执行构造而不执行拷贝构造。 如何理解上面这句话先来看一个场景。 class test { public:test(){}test(int i){ std::cout test(int i) std::endl; }test(const test _test){ std::cout test(const test _test) std::endl; } };int main() {std::vectortest arr;arr.reserve(5);arr.push_back(1);arr.emplace_back(1);return 0; }test类显式写出了三个构造函数分别是无参构造、单参数构造、拷贝构造。因为C中单参数的构造函数支持隐式类型转换因此可以拿一个整型构造一个test对象。除非用explicit修饰构造函数表示禁止隐式类型转换构造。 test(int i) test(const test _test) test(int i)这是上述代码的运行结果可以看到push_back中会用整数1构造一个test对象再通过拷贝构造再构造一个对象这才是插入到arr数组中的对象。 而emplace_back只有一次隐式类型转换的构造因为emplace是直接使用参数在容器管理的内存空间中直接构造元素因此没有拷贝的操作在一定程度上提高了效率。 写入大数据时的性能差异 class test { public:test(){}test(int i){ }test(const test _test){ } };void test_push_back() {clock_t start clock();std::vectortest arr;arr.reserve(1000000000);for(int i 0; i 1000000000; i){arr.push_back(1);}std::cout 耗时 (clock() - start) std::endl;/*耗时24.41秒*/ }void test_emplace_back() {clock_t start clock();std::vectortest arr;arr.reserve(1000000000);for(int i 0; i 1000000000; i){arr.emplace_back(1);}std::cout 耗时 (clock() - start) std::endl;/*耗时15.86秒*/ }int main() {test_push_back();test_emplace_back();return 0; }shell脚本用于实时监控进程运行状况 while true; do ps aux | head -1 ; ps aux | grep a.out; printf ——————————————————————\n\n ; sleep 1; done一个栈上的test对象的大小是1个字节因为test类没有存储对象成员而编译器为了表明一个test对象存在需要用1字节作为占位符。 109 个对象即1亿个1个对象是1个字节。后台检测到有982456个字节即大约1GB。可以看到插入109个test对象的时候差距大概是10秒钟。 应用场景 你可能说这种优化有什么用有什么类会允许隐式类型转换还可能插入的时候不显式构造 没错就是string。 void test_push_back() {clock_t start clock();std::vectorstd::string arr;arr.reserve(1000000000);for(int i 0; i 100000000; i){arr.push_back(Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! );}std::cout 耗时 (clock() - start) std::endl;/*耗时25.66秒*/ }void test_emplace_back() {clock_t start clock();std::vectorstd::string arr;arr.reserve(1000000000);for(int i 0; i 100000000; i){arr.emplace_back(Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! Hello World !!! );}std::cout 耗时 (clock() - start) std::endl;/*耗时16.20秒*/ }耗时20.39秒 耗时17.87秒可是差距好像并不是很大- 综上所述可能提升有限但是能使用emplace_back还是不使用push_back了。
http://www.dnsts.com.cn/news/271356.html

相关文章:

  • 旅游网站建设风险网站开发的目的 实习报告
  • 做兼职女的网站北京本地网络推广平台
  • 南宁工程建设网站有哪些搜狗收录批量查询
  • 建设班级网站首页微信公众号怎么开店
  • 网站做抽奖活动网站后台登陆地址
  • 有做材料的网站吗上线了建站教程
  • 国外做的不错的网站石家庄网站建设开发
  • 做网站用什么需要好音乐网站制作教程步骤
  • 外贸电商平台哪个网站最好天猫入驻官网入口
  • 建网站支持设备是什么意思微网站怎么做微名片
  • 什么公司做企业网站深圳seo优化排名公司
  • 东莞企业建站程序学生个人网页制作html动态
  • 网站开发实战答案网站ps照片怎么做
  • 怎么制作网站卖东西动易的网站能否静态
  • 松江网站建设wordpress中文团队
  • 对公司网站建设的建议广州正规网站建设哪家好
  • 商河做网站多少钱贵州省住房和城乡建设部网站
  • 经营购物网站html网站模板资源
  • 网站301多久郑州网站建设技术
  • 钓鱼网站链接怎么做重庆企业网站推广平台
  • 网站建设培训 店asp的网站空间
  • 深圳市建设监理协会网站青州网站建设推广
  • 做酒店网站多少钱怎么做招聘网站的数据分析
  • wordpress站群是什么高端的网站优化公司
  • 湖北城市建设职业技术学院网站白云做网站公司
  • 网站 备案 名称竞价服务托管价格
  • 烟台建设企业网站广州营销型网站建设怎么样
  • 网站建设框架图做网站是那个语言写的
  • 龙岩网站报价这样做网站推广
  • 网站设计师是什么专业网页设计一级页面