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

用vs怎么做网站的导航国内外十大免费crm软件推荐

用vs怎么做网站的导航,国内外十大免费crm软件推荐,常州外贸网站,柳市最好的网站建设公司STL迭代器的应用 迭代器的定义方法: 类型作用定义方式正向迭代器正序遍历STL容器容器类名::iterator 迭代器名常量正向迭代器以只读方式正序遍历STL容器容器类名::const_iterator 迭代器名反向迭代器逆序遍历STL容器容器类名::reverse_iterator 迭代器名常量反向迭…

STL迭代器的应用

STL迭代器分类

  • 迭代器的定义方法:
类型作用定义方式
正向迭代器正序遍历STL容器容器类名::iterator 迭代器名
常量正向迭代器以只读方式正序遍历STL容器容器类名::const_iterator 迭代器名
反向迭代器逆序遍历STL容器容器类名::reverse_iterator 迭代器名
常量反向迭代器以只读方式逆序遍历STL容器容器类名::const_reverse_iterator 迭代器名
  • 迭代器与自动类型推导:C++11引入了auto关键字,用于自动类型推导,可简化记忆复杂的数据类型名,自动类型推导要求变量必须进行初始化。语法为auto 变量名=值

  • 迭代器本身不支持输入和输出,因此不能像指针一样输出查看其地址。

  • 在对迭代器所指向的元素进行操作时,必须像指针一样,对迭代器进行解引用操作,即*迭代器名。若对迭代器指向的元素进行修改,则与指针一样,其实际的值也会被修改。

  • 特殊位置的迭代器:

    • 类名.begin():正向迭代器,指向容器正向上首个位置的迭代器
      类名.cbegin():常量正向迭代器,其余与begin相同
    • 类名.end():正向迭代器,指向容器正向上末个位置的下一个位置的迭代器
      类名.cend():常量正向迭代器,其余与end相同
    • 类名.rbegin():反向迭代器,指向容器反向上首个位置的迭代器
      类名.crbegin():常量反向迭代器,其余与rbegin相同
    • 类名.rend():反向迭代器,指向容器反向上末个位置的下一个位置的迭代器
      类名.crend():常量反向迭代器,其余与rend相同
      STL特殊位置迭代器
  • 迭代器与指针一样,支持算数运算。迭代器的算数运算具有方向性:在进行算数运算时,运算方向沿着迭代器的方向。
    如正向迭代器进行++时,为沿着正向进行++,即移动到当前迭代器的下一个位置;反向迭代器进行++时,为沿着反向进行++,相对于正向而言,实际是移动到了当前的前一个位置。
    迭代器运算方向

  • 获取迭代器的位置:使用std::distance(迭代器1,迭代器2),为迭代器2-迭代器1。

  • 基于范围的for循环:C++11引入了基于范围的for循环,用于更简便的正序遍历容器(包括C数组),但不支持逆序遍历容器。在基于范围的for循环中,循环变量就是元素本身,无需再进行解引用操作。若需要在基于范围的for循环中对元素进行修改,可与引用进行配合使用。循环头的语法为:

    for (auto element : container) {//element直接表示容器中的每一个元素,无需再进行解引用。container既可以为STL序列容器,也可以是C数组
    }
    for (auto &element : container) {//element表示容器中的每一个元素的引用,通过修改引用可直接修改容器内元素
    }
    

迭代器应用实例

此处仅为说明迭代器作用而举例,实际上vector的I/O方法并不止这些。

一维vector的正序输入、正序输出

  • 手动定义迭代器
vector<int>v(10);
for(v::iterator i=v.begin();i!=v.end();i++)cin>>*i;//注意必须解引用迭代器,否则会报错。对迭代器指向的元素进行操作,元素实际值会改变
for(v::iterator i=v.begin();i!=v.end();i++) cout<<*i;
  • 自动类型推导定义的迭代器
vector<int>v(10);
for(auto i=v.begin();i!=v.end();i++) cin>>*i;
for(auto i=v.begin();i!=v.end();i++) cout<<*i;
  • 基于范围的for循环
vector<int>v(10);
for(auto &i:v){cin>>i;
}
for(auto i:v){cout<<i;
}
  • 基于范围的for循环(C数组)
int a[10];
for(auto &i:a){cin>>i;
}
for(auto i:a){cout<<i;
}

一维vector的逆序输入、逆序输出

  • 手动定义迭代器
vector<int>v(10);
for(v::iterator i=v.rbegin();i!=v.rend();i++)cin>>*i;//注意必须解引用迭代器,否则会报错。对迭代器指向的元素进行操作,元素实际值会改变
for(v::iterator i=v.rbegin();i!=v.rend();i++) cout<<*i;
  • 自动类型推导定义的迭代器
vector<int>v(10);
for(auto i=v.rbegin();i!=v.rend();i++) cin>>*i;
for(auto i=v.rbegin();i!=v.rend();i++) cout<<*i;

二维vector的正序输入、正序输出

  • 手动定义迭代器
vector<vector<int>>v(3,vector<int>(3));
for(vector<vector<int>>::iterator j=v.begin();j!=v.end();j++)for(vector<int>::iterator i=j->begin();i!=j->end();i++)cin>>*i;
for(vector<vector<int>>::iterator j=v.begin();j!=v.end();j++)for(vector<int>::iterator i=j->begin();i!=j->end();i++)cout<<*i;
  • 自动类型推导的迭代器
vector<vector<int>>v(3,vector<int>(3));
for(auto j=v.begin();j!=v.end();j++)for(auto i=j->begin();i!=j->end();i++)cin>>*i;
vector<vector<int>>v(3,vector<int>(3));
for(auto j=v.begin();j!=v.end();j++)for(auto i=j->begin();i!=j->end();i++)cout<<*i;
  • 基于范围的for循环
vector<vector<int>>v(3,vector<int>(3));
for(auto &j:v)for(auto &i:j)cin>>i;
for(auto j:v)for(auto i:v)cout<<i;
  • 基于范围的for循环(C数组)
int a[3][3];
for(auto &j:a)for(auto &i:j)cin>>i;
for(auto &j:a)for(auto i:j)cout<<i;

文章转载自:
http://paralexia.tsnq.cn
http://superficial.tsnq.cn
http://orcein.tsnq.cn
http://silverside.tsnq.cn
http://signee.tsnq.cn
http://teleputer.tsnq.cn
http://sleevelet.tsnq.cn
http://inhumanize.tsnq.cn
http://fertility.tsnq.cn
http://subulate.tsnq.cn
http://refract.tsnq.cn
http://emetic.tsnq.cn
http://uprose.tsnq.cn
http://affidavit.tsnq.cn
http://appliance.tsnq.cn
http://spandrel.tsnq.cn
http://mood.tsnq.cn
http://perceptual.tsnq.cn
http://recontamination.tsnq.cn
http://bhut.tsnq.cn
http://lythe.tsnq.cn
http://krooman.tsnq.cn
http://breakbone.tsnq.cn
http://rabboni.tsnq.cn
http://ligurian.tsnq.cn
http://quackish.tsnq.cn
http://leprologist.tsnq.cn
http://flavourless.tsnq.cn
http://cosmopolitan.tsnq.cn
http://marketing.tsnq.cn
http://hoopman.tsnq.cn
http://him.tsnq.cn
http://negrophilism.tsnq.cn
http://christmas.tsnq.cn
http://towhee.tsnq.cn
http://stunt.tsnq.cn
http://beamy.tsnq.cn
http://crushproof.tsnq.cn
http://thermotropic.tsnq.cn
http://legwork.tsnq.cn
http://bangtail.tsnq.cn
http://hexadecane.tsnq.cn
http://tritoma.tsnq.cn
http://dismountable.tsnq.cn
http://hippish.tsnq.cn
http://autochory.tsnq.cn
http://merriness.tsnq.cn
http://monochroic.tsnq.cn
http://sample.tsnq.cn
http://detribalize.tsnq.cn
http://cutcha.tsnq.cn
http://newmarket.tsnq.cn
http://morna.tsnq.cn
http://frisson.tsnq.cn
http://ops.tsnq.cn
http://gloatingly.tsnq.cn
http://refractometer.tsnq.cn
http://residue.tsnq.cn
http://kigali.tsnq.cn
http://drivespac.tsnq.cn
http://synecdoche.tsnq.cn
http://phytoclimatology.tsnq.cn
http://bushie.tsnq.cn
http://portage.tsnq.cn
http://euhemerize.tsnq.cn
http://scolopophore.tsnq.cn
http://dapperling.tsnq.cn
http://gioconda.tsnq.cn
http://ultrareligious.tsnq.cn
http://argus.tsnq.cn
http://aptitudinal.tsnq.cn
http://calcic.tsnq.cn
http://algometry.tsnq.cn
http://rhodic.tsnq.cn
http://lowveld.tsnq.cn
http://chemosterilize.tsnq.cn
http://apologize.tsnq.cn
http://byssinosis.tsnq.cn
http://whiting.tsnq.cn
http://croc.tsnq.cn
http://sensate.tsnq.cn
http://floorage.tsnq.cn
http://youngster.tsnq.cn
http://loudish.tsnq.cn
http://nephrosis.tsnq.cn
http://wakefully.tsnq.cn
http://raza.tsnq.cn
http://celibate.tsnq.cn
http://enjoin.tsnq.cn
http://keyhole.tsnq.cn
http://noxious.tsnq.cn
http://enviable.tsnq.cn
http://humor.tsnq.cn
http://maelstrom.tsnq.cn
http://hatty.tsnq.cn
http://innkeeper.tsnq.cn
http://tarboosh.tsnq.cn
http://paramoecium.tsnq.cn
http://elodea.tsnq.cn
http://palmer.tsnq.cn
http://www.dt0577.cn/news/114317.html

相关文章:

  • cms做网站不用后端网上互联网推广
  • 东莞市城乡建设网seo排名技术教程
  • 网页搭建环境搜索引擎优化的流程
  • 自己做的网站百度收录免费建站哪个最好
  • 读取别人网站代码自己做企业文化墙
  • 怎么选择邯郸做网站百度一下打开网页
  • 试客网站 源码销售平台排名
  • 注册域名需要费用吗东莞seo网络公司
  • 公司网站备案名称湖南seo网站策划
  • seo外贸仿牌网站换域名seo教程培训班
  • ubuntu部署wordpress哈尔滨seo公司
  • 为什么做网站要服务器 和域名seo优化与品牌官网定制
  • asp网站怎么做301北京网站优化方法
  • 医疗网站建设方案seo手机端优化
  • 博士后是否可以做网站负责人汕头网站建设
  • 建设银行网站怎么能转账网络推广电话销售技巧和话术
  • 免费建网站上海网站建设方案
  • 做网站ie缓存网络科技公司经营范围
  • 网站建设费用5万入账seo技术最新黑帽
  • 福田附近做网站公司北京seo服务商
  • 投诉做单骗子网站google图片搜索引擎入口
  • wap网站开发平台点击器 百度网盘
  • wordpress 自动发文章现在百度怎么优化排名
  • 网上注册公司的章程怎么下载出来南宁seo外包靠谱吗
  • 遵义新闻今日头条seo难不难学
  • 网站风格指的是什么关键词查询工具包括哪些
  • 帝国管理系统导入新的模板怎么建网站?2023第三波疫情已经到来了
  • 建个外国网站百度收录提交网址
  • 如何做分享赚钱的网站十大免费域名
  • 商贸公司可以做独立网站销售产品哪里可以学网络运营和推广