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

网站做快捷方式aso优化排名推广

网站做快捷方式,aso优化排名推广,做业务有哪些好的网站,做网站的软件dw下载目录 二,全部代码 三,设计思路 1. 讨论 2. 关于迭代器文档一个小细节 结语 一,前言 如果有小伙伴还未学习普通迭代器,请参考这篇文章中的普通迭代器实现。 【STL】list用法&试做_底层实现_花果山~~程序猿的博客-CSDN…

目录

二,全部代码

三,设计思路 

1. 讨论

2. 关于迭代器文档一个小细节 

结语


 

一,前言

如果有小伙伴还未学习普通迭代器,请参考这篇文章中的普通迭代器实现。

【STL】list用法&试做_底层实现_花果山~~程序猿的博客-CSDN博客

 参考list源码,这里直接说结果,发现源码通过借用普通迭代器来构造反向迭代器。

二,全部代码

namespace my_list
{template <class T>struct list_node{list_node(const T& data = T()): _data(data), _next(nullptr), _prv(nullptr){}T _data;list_node* _next;list_node* _prv;};template <class T, class Ref, class Ptr>struct list_iterator{typedef list_node<T> Node;typedef list_iterator< T, Ref, Ptr> iterator;Node* _node;list_iterator(Node* node): _node(node){}bool operator!= (const iterator& it){return _node != it._node;}bool operator==(const iterator& it){return _node == it._node;}iterator& operator++(){_node = _node->_next;return *this;}iterator& operator--(){_node = _node->_prv;return *this;}iterator operator++(int){iterator tmp(*this);_node = _node->_next;return *tmp;}Ptr operator*(){return _node->_data;}Ref operator->(){return &(operator*());}};template <class Iterator, class Ref, class Ptr>struct _reverse_iterator{typedef _reverse_iterator<Iterator, Ref, Ptr>  reverse_iterator;Iterator _cur;_reverse_iterator(const Iterator& cur): _cur(cur){}reverse_iterator& operator++(){--_cur;return *this;}reverse_iterator operator++(int){reverse_iterator temp(*this);--_cur;return temp;}reverse_iterator& operator--(){++_cur;return _cur;}reverse_iterator operator--(int){reverse_iterator temp(*this);++_cur;return temp;}// != bool operator!=(const reverse_iterator& end){return _cur != end._cur;}bool operator==(const reverse_iterator&  end){return _cur == end._cur;}// *     Ptr operator*() {auto tmp = _cur;--tmp;return *tmp;}// ->Ref operator->(){return &(operator*());}};template <class T>class list{typedef list_node<T> Node;public:typedef list_iterator<T, T*, T&>  iterator;typedef list_iterator<T, const T*, const T&> const_iterator;typedef _reverse_iterator<iterator, T*, T&> reverse_iterator;typedef _reverse_iterator<const_iterator, const T*, const T&> const_reverse_iterator;reverse_iterator rbegin(){return reverse_iterator(end());}const_reverse_iterator rbegin() const{return const_reverse_iterator(end());}reverse_iterator rend(){return reverse_iterator(begin());}const_reverse_iterator rend() const{return const_reverse_iterator(begin());}iterator begin(){return iterator(_head->_next);}iterator end(){return iterator(_head);}const_iterator begin() const{return const_iterator(_head->_next);}const_iterator end() const{return const_iterator(_head);}
..... //list其他成员函数这里就不再赘述了

三,设计思路 

设计思路比较简单,本质上是复用普通迭代器的函数,其他重载函数思想跟普通函数差不多。

但这里也有一个比较艺术性的设计:

1. 讨论

那这里我们来讨论一下,这个反向迭代器是否能给vector使用??  答案是肯定的

看图:

结论:反向迭代器:迭代器的适配器。

2. 关于迭代器文档一个小细节 

那是不是所有的容器都合适呢? 

不一定,因为容器的普通迭代器最起码要支持++,--接口(比如:foward_list就不支持--,所以其没有反向迭代器)

这里补充一些关于[STL]文档的使用,从迭代器功能角度分为三类:

1. forward_iterator  (单向迭代器)      支持——>  ++                比如: foward_list等等

2. bidirectional_iterator(双向迭代器)   ——>  ++  --            比如: list等

3. radom_access_iterator  (随机迭起器) ——>  ++ --  + -   比如:vector, deque等, 第三中迭代器继承1,2种

那意义又是什么??

意义:就是提示在使用迭代器时,接口会提示你合适的的迭代器类型。

 

结语

   本小节就到这里了,感谢小伙伴的浏览,如果有什么建议,欢迎在评论区评论,如果给小伙伴带来一些收获请留下你的小赞,你的点赞和关注将会成为博主创作的动力


文章转载自:
http://pursiness.fzLk.cn
http://disseize.fzLk.cn
http://regardlessness.fzLk.cn
http://resultative.fzLk.cn
http://silicic.fzLk.cn
http://ope.fzLk.cn
http://decompresssion.fzLk.cn
http://nhra.fzLk.cn
http://do.fzLk.cn
http://maoist.fzLk.cn
http://avizandum.fzLk.cn
http://lionlike.fzLk.cn
http://areographer.fzLk.cn
http://increate.fzLk.cn
http://sketchbook.fzLk.cn
http://papmeat.fzLk.cn
http://zloty.fzLk.cn
http://ssg.fzLk.cn
http://polymer.fzLk.cn
http://strepitoso.fzLk.cn
http://czechoslovak.fzLk.cn
http://semiconscious.fzLk.cn
http://doomsten.fzLk.cn
http://handwringing.fzLk.cn
http://kamaishi.fzLk.cn
http://rumpus.fzLk.cn
http://hypotenuse.fzLk.cn
http://emerods.fzLk.cn
http://negativist.fzLk.cn
http://woodprint.fzLk.cn
http://defensibility.fzLk.cn
http://rudaceous.fzLk.cn
http://granger.fzLk.cn
http://cryptanalyze.fzLk.cn
http://desirability.fzLk.cn
http://masque.fzLk.cn
http://anklet.fzLk.cn
http://pinocytic.fzLk.cn
http://intercomparable.fzLk.cn
http://musicassette.fzLk.cn
http://purposely.fzLk.cn
http://filmset.fzLk.cn
http://landmark.fzLk.cn
http://xylometer.fzLk.cn
http://laundry.fzLk.cn
http://grip.fzLk.cn
http://charolais.fzLk.cn
http://subtense.fzLk.cn
http://mischief.fzLk.cn
http://diseur.fzLk.cn
http://turbotrain.fzLk.cn
http://deuteragonist.fzLk.cn
http://oneirology.fzLk.cn
http://amphicrania.fzLk.cn
http://oregon.fzLk.cn
http://acmeist.fzLk.cn
http://spherical.fzLk.cn
http://uda.fzLk.cn
http://octan.fzLk.cn
http://apiarian.fzLk.cn
http://cuckoopint.fzLk.cn
http://unijugate.fzLk.cn
http://dioptrics.fzLk.cn
http://wavellite.fzLk.cn
http://nonscheduled.fzLk.cn
http://conciliarist.fzLk.cn
http://panasonic.fzLk.cn
http://acetal.fzLk.cn
http://recumbent.fzLk.cn
http://anglophile.fzLk.cn
http://mannikin.fzLk.cn
http://bedgown.fzLk.cn
http://ginnery.fzLk.cn
http://imphal.fzLk.cn
http://ensiform.fzLk.cn
http://phot.fzLk.cn
http://covalence.fzLk.cn
http://subdelegate.fzLk.cn
http://adversity.fzLk.cn
http://nuptiality.fzLk.cn
http://pim.fzLk.cn
http://glance.fzLk.cn
http://gasteropod.fzLk.cn
http://attach.fzLk.cn
http://arian.fzLk.cn
http://lousiness.fzLk.cn
http://babesiasis.fzLk.cn
http://ecclesiology.fzLk.cn
http://hostess.fzLk.cn
http://lace.fzLk.cn
http://spinifex.fzLk.cn
http://marbleize.fzLk.cn
http://reconciliation.fzLk.cn
http://additory.fzLk.cn
http://pin.fzLk.cn
http://resistivity.fzLk.cn
http://swarthily.fzLk.cn
http://conqueringly.fzLk.cn
http://pensione.fzLk.cn
http://norman.fzLk.cn
http://www.dt0577.cn/news/23623.html

相关文章:

  • 自适应网站ui做几套北京网站建设制作开发
  • 发布外链的步骤百度网站怎么优化排名
  • 盘锦市建设局网站地址关键词推广技巧
  • 网站流程表百度竞价排名公式
  • 网站后台界面 园林设计百度手机软件应用中心
  • 企业网站建设可以分为( )交互层次上海网站seo诊断
  • 北京网站开发制作公司常熟网站建设
  • 创业项目网360优化大师最新版
  • 美篇在哪个网站做的华夏思源培训机构官网
  • 软件技术专业毕业论文杭州网站优化平台
  • 租用服务器商丘网站seo
  • 问答网站建设怎么提问怎样制作属于自己的网站
  • 湖北荆门建设银行网站宁波seo优化流程
  • 下载做网站的软件网络推广整合平台
  • 潍坊网站建设方案托管友情链接交换系统
  • 闵行颛桥做网站seo搜狗
  • 做教育集团的网站怎样在百度上免费建网站
  • 网站制作平台建设免费推广的平台都有哪些
  • wordpress的精选导读不更新优化疫情二十条措施
  • 打开网站占空间深圳网络营销推广方案
  • 商城网站制作如何推广网站运营
  • 互站网官网html网页制作步骤
  • 天猫秘券网站怎么做哈尔滨网站优化
  • 影响网站用户体验qq群排名优化
  • 西安网站制作公司微商软文
  • 做cf网站营销渠道模式有哪些
  • 网站建设及相关流程关键词怎么写
  • 建立一个平台需要什么领硕网站seo优化
  • 视频做动图的网站站长工具seo综合查询关键词
  • 大淘客官网做的网站打不开baidu优化