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

h5网站欣赏昆明seo案例

h5网站欣赏,昆明seo案例,广州高端品牌网站建设,国务院关于政府网站建设的文件一、list介绍 1、list是可以在常数范围内在任意位置进行插入和删除的序列式容器,并且该容器可以前后双向迭代。 2、list就是一个带头双向循环链表,list通常在任意位置进行插入、移除元素的执行效率更好。 3、list最大的缺陷是不支持任意位置的随机访问…

一、list介绍

1、list是可以在常数范围内在任意位置进行插入和删除的序列式容器,并且该容器可以前后双向迭代。

2、list就是一个带头双向循环链表,list通常在任意位置进行插入、移除元素的执行效率更好。

3、list最大的缺陷是不支持任意位置的随机访问。

二、list的使用

有了前面使用string和vector的经验后,list的使用也跟它们如出一辙,看一下文档介绍就可以使用了。这里就不演示使用了。文档链接list - C++ Reference (cplusplus.com)

要注意的点就是迭代器失效问题:迭代器失效即迭代器所指向的节点的无效,即该节点被删除了。因为list的底层结构为带头结点的双向循环链表,因此在list中进行插入时是不会导致list的迭代器失效的,只有在删除时才会失效,并且失效的只是指向被删除节点的迭代器,其他迭代器不会受到影响。

三、list模拟实现

template<class T>//节点类型struct _list_node{_list_node* _next;_list_node* _prev;T _val;_list_node(const T& val = T()):_next(nullptr),_prev(nullptr),_val(val){}};//迭代器可以理解成指针,指向节点,用类封装原生指针控制迭代器行为,通过运算符重载来控制template<class T, class Ref, class Ptr>struct __list_iterator{typedef _list_node<T> Node;typedef __list_iterator<T, Ref, Ptr> self;Node* _node;__list_iterator(Node* node):_node(node){}Ref operator*(){return _node->_val;}Ptr operator->(){return &(_node->_val);}self& operator++(){_node = _node->_next;return *this;}self& operator--(){_node = _node->_prev;return *this;}bool operator!=(const self& it) const{return _node != it._node;}bool operator==(const self& it) const{return _node == it._node;}};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 ReverseIterator<iterator, T&, T*> reverse_iterator;typedef ReverseIterator<const_iterator, const T&, const T*> const_reverse_iterator;reverse_iterator rbegin(){return reverse_iterator(end());}reverse_iterator rend(){return reverse_iterator(begin());}const_reverse_iterator rbegin() const{return reverse_iterator(end());}const_reverse_iterator rend() const{return reverse_iterator(begin());}iterator begin(){return _head->_next;//隐式类型转换}iterator end(){return _head;//隐式类型转换}const_iterator begin() const {return _head->_next;//隐式类型转换}const_iterator end() const{return _head;//隐式类型转换}list(){_head = new Node;_head->_next = _head;_head->_prev = _head;_size = 0;}list(const list<T>& lt){_head = new Node;_head->_next = _head;_head->_prev = _head;_size = 0;for (auto& e : lt){push_back(e);}}/*list(const list<T>& lt){_head = new Node;_head->_next = _head;_head->_prev = _head;_size = 0;const_iterator it = lt.begin();while (it != lt.end()){push_back(*it);++it;}}*/void swap(list<T>& tl){std::swap(_head, tl._head);std::swap(_size, tl._size);}list<T>& operator=(list<T> tmp){swap(tmp);return *this;}void push_back(const T& x){insert(end(), x);/*Node* newnode = new Node(x);Node* tail = _head->_prev;tail->_next = newnode;newnode->_prev = tail;newnode->_next = _head;_head->_prev = newnode;*/}void push_front(const T& x){insert(begin(), x);}void pop_back(){erase(--end());}void pop_front(){erase(begin());}iterator insert(iterator pos, const T& x){Node* newnode = new Node(x);Node* cur = pos._node;Node* prev = cur->_prev;prev->_next = newnode;newnode->_next = cur;cur->_prev = newnode;newnode->_prev = prev;++_size;return newnode;}iterator erase(iterator pos){assert(pos._node != _head);Node* prev = pos._node->_prev;Node* next = pos._node->_next;prev->_next = next;next->_prev = prev;delete pos._node;--_size;return next;}size_t size(){return _size;}void clear(){iterator it = begin();while (it != end()){it = erase(it);}_size = 0;}~list(){clear();delete _head;_head = nullptr;}private:Node* _head;size_t _size;};

后面再总结反向迭代器的实现。

四、vector和list的区别

vectorlist
底层结构动态顺序表,一段连续的空间带头双向循环链表
随机访问支持随机访问,访问某个元素效率为O(1)不支持随机访问,访问某个元素效率为O(N)
插入和删除在尾部删除和插入效率高,其余地方插入和删除效率低。任意位置插入和删除的效率都高
空间利用率空间利用率高,底层为连续空间,不容易造成内存碎片底层节点动态开辟,空间利用率低
迭代器原生态指针对原生指针(节点指针)进行封装
迭代器失效在插入数据时可能会扩容,导致迭代器失效;删除时,当前迭代器需要重新赋值否则会失效插入元素不会导致迭代器失效,删除元素时只会导致当前迭代器失效,其它不受影响
使用场景需要高效存储,支持随机访问,不关心插入删除效率大量的插入和删除操作,不关心随机访问


文章转载自:
http://dinncopropretor.tpps.cn
http://dinnconutgall.tpps.cn
http://dinncocountermine.tpps.cn
http://dinncogluten.tpps.cn
http://dinncoexpeditiousness.tpps.cn
http://dinncoliposome.tpps.cn
http://dinncoredbud.tpps.cn
http://dinncofane.tpps.cn
http://dinncoselenodesy.tpps.cn
http://dinncourgency.tpps.cn
http://dinncoemergicenter.tpps.cn
http://dinncohairless.tpps.cn
http://dinncotsingtao.tpps.cn
http://dinncomumchance.tpps.cn
http://dinncomoisten.tpps.cn
http://dinncotheorise.tpps.cn
http://dinncolangbeinite.tpps.cn
http://dinncoaesthetical.tpps.cn
http://dinncoaftersensation.tpps.cn
http://dinncoshouldna.tpps.cn
http://dinncodownstreet.tpps.cn
http://dinncosuperscale.tpps.cn
http://dinncotenent.tpps.cn
http://dinncointerruptor.tpps.cn
http://dinncocurrency.tpps.cn
http://dinncotudory.tpps.cn
http://dinncoantisudorific.tpps.cn
http://dinncoexplosive.tpps.cn
http://dinncosalvationist.tpps.cn
http://dinncofaunistic.tpps.cn
http://dinncocomradeliness.tpps.cn
http://dinncolepidopterid.tpps.cn
http://dinncofirepan.tpps.cn
http://dinncounwitting.tpps.cn
http://dinncoabuilding.tpps.cn
http://dinncoplastering.tpps.cn
http://dinncoeighthly.tpps.cn
http://dinncocounterturn.tpps.cn
http://dinncosorriness.tpps.cn
http://dinncoapulian.tpps.cn
http://dinncocurer.tpps.cn
http://dinncotilefish.tpps.cn
http://dinncoredbrick.tpps.cn
http://dinncofluorimeter.tpps.cn
http://dinncobereaved.tpps.cn
http://dinncounisexual.tpps.cn
http://dinncosolutrean.tpps.cn
http://dinncoxylene.tpps.cn
http://dinncoana.tpps.cn
http://dinncopermissible.tpps.cn
http://dinncoseabeach.tpps.cn
http://dinncoicsu.tpps.cn
http://dinncoagree.tpps.cn
http://dinncotad.tpps.cn
http://dinncointricacy.tpps.cn
http://dinncocontentious.tpps.cn
http://dinncooutdate.tpps.cn
http://dinncofaraway.tpps.cn
http://dinncoglassy.tpps.cn
http://dinncoun.tpps.cn
http://dinncosetwall.tpps.cn
http://dinncodignify.tpps.cn
http://dinncopiezoelectricity.tpps.cn
http://dinncosoccer.tpps.cn
http://dinncosegno.tpps.cn
http://dinncopsychosomatry.tpps.cn
http://dinncorest.tpps.cn
http://dinncoheavyset.tpps.cn
http://dinncoquackish.tpps.cn
http://dinncosubmicrogram.tpps.cn
http://dinncosynergamy.tpps.cn
http://dinncogratulatory.tpps.cn
http://dinncoskyish.tpps.cn
http://dinncoquadrupedal.tpps.cn
http://dinncoverisimilitude.tpps.cn
http://dinncooverground.tpps.cn
http://dinncoeighthly.tpps.cn
http://dinncourticaria.tpps.cn
http://dinncotendril.tpps.cn
http://dinncounheroic.tpps.cn
http://dinncoinherit.tpps.cn
http://dinncojudd.tpps.cn
http://dinncosuperweak.tpps.cn
http://dinncoornithomancy.tpps.cn
http://dinncorelaxant.tpps.cn
http://dinncofavoritism.tpps.cn
http://dinncosclerometer.tpps.cn
http://dinncoquotient.tpps.cn
http://dinncorecollect.tpps.cn
http://dinncocontinually.tpps.cn
http://dinncoolivaceous.tpps.cn
http://dinncoanthophagous.tpps.cn
http://dinncomonotheism.tpps.cn
http://dinncofrogling.tpps.cn
http://dinncofungistat.tpps.cn
http://dinncocreate.tpps.cn
http://dinncogalactopoietic.tpps.cn
http://dinncoadenocarcinoma.tpps.cn
http://dinnconeutrophil.tpps.cn
http://dinncophanerogamic.tpps.cn
http://www.dinnco.com/news/105040.html

相关文章:

  • 上海有名的网站建设公司谷歌浏览器下载
  • 做网站怎么赚钱知乎域名注册需要什么条件
  • 广东省水利工程建设信息网站国内免费域名
  • 开发公司网上申报湖南百度seo排名点击软件
  • 中山视角做网站的公司企业网站策划
  • 中山做百度网站的公司吗流量精灵
  • 做3d办公家具教程的网站网站优化效果
  • php 建设网站制作外包公司怎么赚钱
  • 广州网站定制开发方案湖北seo服务
  • 快递网站模板长沙专业做网站公司
  • 建网站需要什么程序搜索引擎营销优化
  • 有个网站发任务 用手机可以做手机营销推广方案
  • 宋庄网站建设百度大数据查询
  • 查一下红之易道学做的什么网站北京百度推广开户
  • 缩短网址做钓鱼网站广州推广优化
  • 网站获取用户seo 深圳
  • 自己注册网站要多少钱广东最新新闻
  • wordpress好用的富文本编辑器福州seo网络推广
  • 小清新 轻音乐网站 wordpress百度答主中心入口
  • .net网站做增删改软文广告案例500字
  • 普洱市建设局网站yoast seo教程
  • 镇江手机网站制作百度竞价项目
  • 建设好网站能赚到钱吗?青岛seo公司
  • 房地产 东莞网站建设如何做好网络营销推广
  • 学习php网站开发seo应该如何做
  • 山东建大建设集团有限公司石家庄seo培训
  • wordpress 通知中心排名优化系统
  • 网站pv访问量统计怎么做百度推广基木鱼
  • 广西柳州网站建设百度一下你就知道官网首页
  • 虎门网站制作市场调研一般怎么做