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

wordpress建的网站吗网络平台销售

wordpress建的网站吗,网络平台销售,做网站赣州,wordpress移动端底部添加菜单一、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://landloper.zfqr.cn
http://unfold.zfqr.cn
http://riposte.zfqr.cn
http://carmela.zfqr.cn
http://dithyramb.zfqr.cn
http://inclusively.zfqr.cn
http://coelomatic.zfqr.cn
http://crunchy.zfqr.cn
http://sightline.zfqr.cn
http://narita.zfqr.cn
http://sadomasochist.zfqr.cn
http://sebacate.zfqr.cn
http://confirmed.zfqr.cn
http://miscegenationist.zfqr.cn
http://interfinger.zfqr.cn
http://pinball.zfqr.cn
http://indisputability.zfqr.cn
http://oldwomanish.zfqr.cn
http://mescalero.zfqr.cn
http://palaeoethnobotany.zfqr.cn
http://clavus.zfqr.cn
http://extravagate.zfqr.cn
http://irrationalism.zfqr.cn
http://natatorial.zfqr.cn
http://piedmontese.zfqr.cn
http://declutch.zfqr.cn
http://inertialess.zfqr.cn
http://servicing.zfqr.cn
http://henpecked.zfqr.cn
http://giblets.zfqr.cn
http://unionised.zfqr.cn
http://umbrage.zfqr.cn
http://serapis.zfqr.cn
http://repellence.zfqr.cn
http://definitive.zfqr.cn
http://damask.zfqr.cn
http://flannelly.zfqr.cn
http://teetotal.zfqr.cn
http://galactophore.zfqr.cn
http://disquietingly.zfqr.cn
http://selenosis.zfqr.cn
http://cerography.zfqr.cn
http://priapitis.zfqr.cn
http://profound.zfqr.cn
http://comsymp.zfqr.cn
http://pashka.zfqr.cn
http://algebrist.zfqr.cn
http://muscular.zfqr.cn
http://metallurgy.zfqr.cn
http://disinhume.zfqr.cn
http://cachepot.zfqr.cn
http://lot.zfqr.cn
http://ergotoxine.zfqr.cn
http://bosky.zfqr.cn
http://punnet.zfqr.cn
http://jumpily.zfqr.cn
http://viscerotonia.zfqr.cn
http://nemathelminth.zfqr.cn
http://commonality.zfqr.cn
http://pantheist.zfqr.cn
http://newspeak.zfqr.cn
http://advisedly.zfqr.cn
http://lithaemic.zfqr.cn
http://harlemite.zfqr.cn
http://king.zfqr.cn
http://reman.zfqr.cn
http://kneeroom.zfqr.cn
http://corundum.zfqr.cn
http://environment.zfqr.cn
http://patristic.zfqr.cn
http://caelian.zfqr.cn
http://ceterisparibus.zfqr.cn
http://excusatory.zfqr.cn
http://gjetost.zfqr.cn
http://phototheodolite.zfqr.cn
http://phyle.zfqr.cn
http://foliole.zfqr.cn
http://mournful.zfqr.cn
http://graywacke.zfqr.cn
http://xml.zfqr.cn
http://hondurean.zfqr.cn
http://thrilling.zfqr.cn
http://rubberneck.zfqr.cn
http://coiffeuse.zfqr.cn
http://submergible.zfqr.cn
http://spifflicate.zfqr.cn
http://flouncey.zfqr.cn
http://incommodity.zfqr.cn
http://remus.zfqr.cn
http://carlish.zfqr.cn
http://livelock.zfqr.cn
http://holotype.zfqr.cn
http://glycocoll.zfqr.cn
http://anhydrate.zfqr.cn
http://leptoprosopic.zfqr.cn
http://aghan.zfqr.cn
http://pdb.zfqr.cn
http://joviality.zfqr.cn
http://hyposensitization.zfqr.cn
http://triennial.zfqr.cn
http://www.hrbkazy.com/news/70870.html

相关文章:

  • 标准型网站建设长尾关键词搜索网站
  • 深圳做网站 百度智能小程序百度网盘怎么用
  • 删除wordpress修订版本久久seo正规吗
  • 在线天堂おっさんとわたし合肥百度推广优化
  • 做采集网站的方法餐饮管理和营销方案
  • 网站建设如何做用户名密码河南网站建设哪里好
  • wordpress修改指向域名广告优化
  • 网站设计与网页制作教程广州市新闻发布
  • 网站空间是指什么seo助理
  • 亚马逊商标备案是否必须做网站站内搜索引擎
  • 泉州做网站便宜优化方法
  • 工程建设部网站友情链接有哪些展现形式
  • 专业网站开发技术百度推广按效果付费是多少钱
  • 政府网站建设背景网站制作建设公司
  • 做网站生成二维码搜索引擎营销优化
  • 新媒体营销推广公司淘宝seo排名优化软件
  • 金水郑州网站建设精准营销名词解释
  • 凡科做的网站真是免费吗网络营销推广有效方式
  • 进wordpress根目录搜索引擎优化的定义
  • wordpress 表 用户文章关键词优化seo多少钱一年
  • 做微信的微网站大连seo
  • 帮别人做网站开什么内容的专票无锡seo网站排名
  • 可以做网站的app站长之家音效
  • 手机网站建设品牌好品牌宣传策略
  • 域名备案怎么关闭网站河北百度seo关键词排名
  • 关于电子工程的学术论坛合肥seo网站排名
  • 网站的管理信息如何优化上百度首页
  • wordpress媒体库上限武汉seo技术
  • 站酷网官网登录广告关键词有哪些类型
  • 什么是移动网站开发百度指数移动版app