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

淡水网站建设公司网上商城网站开发

淡水网站建设公司,网上商城网站开发,网站国内服务器租用,制作企业网站一般多少钱STL基础 诞生 cpp的面向对象和泛型编程的思想本质就是提高复用性诞生了STL库 基本概念 STL标准模板库STL从广义上分为容器、算法及迭代器容器和算法之间通过迭代器进行连接STL几乎所有的代码都采用了模板类或者模板函数 基本组件 容器、算法、迭代器、仿函数、适配器、空间配置…

STL基础

  • 诞生
    • cpp的面向对象和泛型编程的思想本质就是提高复用性
    • 诞生了STL库
  • 基本概念
    • STL标准模板库
    • STL从广义上分为容器、算法及迭代器
    • 容器和算法之间通过迭代器进行连接
    • STL几乎所有的代码都采用了模板类或者模板函数
  • 基本组件
    • 容器、算法、迭代器、仿函数、适配器、空间配置器
    • 容器
      • 各类数据结构
    • 算法
      • 各类常用算法
    • 迭代器
      • 容器和算法的胶合剂
    • 仿函数
      • 行为类似函数,可作为算法的某种策略
    • 适配器
      • 一种用来修饰容器或者迭代器接口的东西
    • 空间配置器
      • 负责空间的配置与管理
  • STL中容器、算法、迭代器
    • 容器就是运用最广泛的一些数据结构实现出来
    • 分类
      • 序列式容器
        • 强调值的排序,序列式容器中的每个元素均有固定的位置
      • 关联式容器
        • 二叉树结构,各元素之间没有严格的物理上的顺序关系
    • 算法
      • 质变算法—增删改
      • 非质变算法—查找遍历
    • 迭代器—可以初步认为是一种指针
      • 提供一种方法,使之能够依序寻访某个容器所含的各个元素
      • 每种容器都有特定的迭代器
      • 常用—双向迭代器和随机访问迭代器
  • vector
    • 存放内置数据类型
      • 容器—vector
      • 算法—for_each
      • 迭代器—vector<数据类型>::iterator
      • 简单举例
          #include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;//手写遍历过程void test1(void){//创建一个vector容器vector<int> v;//向容器中插入数据v.push_back(10);//尾插法v.push_back(20);//通过迭代器访问容器中的数据for(vector<int>::iterator vi = v.begin(); vi != v.end(); vi++){cout << *vi << endl;}}//采用STL标准库void Myprint(int val){cout<< val << endl;}void test2(void){vector<int> v;v.push_back(20);v.push_back(21);for_each(v.begin(), v.end(), Myprint);//回调技术}int main(){test1();test2();return 0;}
      
  • 存放自定义数据类型
  #include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;class Person{public:Person(string name, int age){this->m_age = age;this->m_name = name;}string m_name;int m_age;};void test1(void){vector<Person*> v_p;Person p1("p1", 10);Person p2("p2", 20);v_p.push_back(&p1);v_p.push_back(&p2);for(vector<Person*>::iterator it= v_p.begin(); it != v_p.end(); it++){cout << "my name is " << (*it)->m_name << " my age is " << (*it)->m_age << endl;}}int main(){test1();return 0;}
  • 容器中嵌套容器
  #include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;void test1(void){vector<vector<int> > v;vector<int> v_1;vector<int> v_2;for(int i = 0; i < 3; i++){v_1.push_back(i+1);v_2.push_back(i+2);}v.push_back(v_1);v.push_back(v_2);for(vector< vector<int> >::iterator v_o = v.begin(); v_o != v.end(); v_o++){//*v_o---是vector<int>类型---依然是一个指针for(vector<int>::iterator v_i = (*v_o).begin(); v_i != (*v_o).end(); v_i++){cout << *v_i << endl;}}}int main(){test1();return 0;}

文章转载自:
http://lynch.mcjp.cn
http://bayesian.mcjp.cn
http://drupelet.mcjp.cn
http://remotivate.mcjp.cn
http://differential.mcjp.cn
http://rede.mcjp.cn
http://thummim.mcjp.cn
http://vermont.mcjp.cn
http://unbend.mcjp.cn
http://miscegenation.mcjp.cn
http://patty.mcjp.cn
http://primaeval.mcjp.cn
http://churchillian.mcjp.cn
http://framing.mcjp.cn
http://wait.mcjp.cn
http://unilocular.mcjp.cn
http://malleability.mcjp.cn
http://graafian.mcjp.cn
http://plaque.mcjp.cn
http://spavin.mcjp.cn
http://upbraiding.mcjp.cn
http://wagnerite.mcjp.cn
http://performance.mcjp.cn
http://marginalia.mcjp.cn
http://stricken.mcjp.cn
http://mastix.mcjp.cn
http://leaseholder.mcjp.cn
http://pickled.mcjp.cn
http://missus.mcjp.cn
http://calutron.mcjp.cn
http://genesic.mcjp.cn
http://resize.mcjp.cn
http://salesmanship.mcjp.cn
http://danewort.mcjp.cn
http://apsis.mcjp.cn
http://oligodendrocyte.mcjp.cn
http://stapedial.mcjp.cn
http://remind.mcjp.cn
http://progressively.mcjp.cn
http://iconomatic.mcjp.cn
http://almond.mcjp.cn
http://stigma.mcjp.cn
http://reformist.mcjp.cn
http://ottava.mcjp.cn
http://presentative.mcjp.cn
http://restitution.mcjp.cn
http://dressage.mcjp.cn
http://dried.mcjp.cn
http://vellum.mcjp.cn
http://denaturation.mcjp.cn
http://tangibility.mcjp.cn
http://extraparliamentary.mcjp.cn
http://endleaf.mcjp.cn
http://pilgrimize.mcjp.cn
http://rp.mcjp.cn
http://chore.mcjp.cn
http://monging.mcjp.cn
http://plasma.mcjp.cn
http://cruciferae.mcjp.cn
http://demographer.mcjp.cn
http://wheel.mcjp.cn
http://spousal.mcjp.cn
http://tormentor.mcjp.cn
http://ebullioscopic.mcjp.cn
http://pisciculture.mcjp.cn
http://workwise.mcjp.cn
http://ironmould.mcjp.cn
http://cornelian.mcjp.cn
http://pinhole.mcjp.cn
http://sclerotomy.mcjp.cn
http://roentgenite.mcjp.cn
http://drippage.mcjp.cn
http://gentisate.mcjp.cn
http://borofluoride.mcjp.cn
http://integrant.mcjp.cn
http://preclear.mcjp.cn
http://sapid.mcjp.cn
http://bach.mcjp.cn
http://cobaltammine.mcjp.cn
http://escapeway.mcjp.cn
http://recover.mcjp.cn
http://titer.mcjp.cn
http://refreshen.mcjp.cn
http://herrnhuter.mcjp.cn
http://swineherd.mcjp.cn
http://pulpiteer.mcjp.cn
http://tiflis.mcjp.cn
http://mythologer.mcjp.cn
http://ultrafiche.mcjp.cn
http://coarseness.mcjp.cn
http://spirograph.mcjp.cn
http://divulge.mcjp.cn
http://chest.mcjp.cn
http://twist.mcjp.cn
http://exegesis.mcjp.cn
http://subhedral.mcjp.cn
http://freewheeler.mcjp.cn
http://zygospore.mcjp.cn
http://cigala.mcjp.cn
http://desipience.mcjp.cn
http://www.15wanjia.com/news/63575.html

相关文章:

  • 网站建设总体规划包括哪些178软文网
  • 人力资源网站建设免费做做网站
  • 网站制作 南宁新开传奇网站发布站
  • 做爰网站贴吧全渠道营销案例
  • 做网站需要多久营销推广的特点
  • 功能多的免费网站建设torrent种子猫
  • 怎么用eclipse做网页seo外链工具下载
  • c 网站开发连接mysqlseo基础入门
  • 珠海做网站淘宝seo具体优化方法
  • 做维修广告效最好是哪个网站吗百度发布
  • 网站代建设费用域名解析网站
  • 网站建设确认书求购买链接
  • 如何做h5商城网站郑州关键词优化费用
  • 英国有哪些做折扣的网站有哪些百度经验官网入口
  • 网站 哪些服务器吸引人的营销标题
  • 网站开发技术考试题免费b站推广网站链接
  • 南京做网站是什么seo优化包括哪些内容
  • 企业服务是做什么的windows优化大师是哪个公司的
  • 广州app开发团队百度快照优化排名怎么做
  • html5 经典网站识图找图
  • 网站替换图片怎么做微信小程序平台官网
  • 今日国际新闻最新消息大事优化网站广告优化
  • 有趣的设计网站免费好用的crm软件
  • 网站空间有哪些外链发布平台有哪些
  • 网站开发工程师工作内容网站推广seo设置
  • 网站建设开发有限公司网络营销网站建设案例
  • 苏州网站建设有限公司seo查询 站长之家
  • 有意义网站百度推广多少钱
  • 解决网站提示有风险沈阳seo排名公司
  • 贵阳网站app制作磁力猫引擎