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

网站建设就选网站推广可采用的方法有哪些

网站建设就选,网站推广可采用的方法有哪些,温州网站制作优化,华为做网站吗list在实际中使用也较为广泛&#xff0c;模拟实现其底层可以让我们更加对模版&#xff0c;类和对象等内容更加了解。 #pragma once #include<iostream> #include<assert.h> using namespace std;namespace cls {template<class T>struct list_node{list_node…

list在实际中使用也较为广泛,模拟实现其底层可以让我们更加对模版,类和对象等内容更加了解。

#pragma once
#include<iostream>
#include<assert.h>
using namespace std;namespace cls
{template<class T>struct list_node{list_node(const T& x = T()):_data(x),_next(nullptr),_prev(nullptr){}T _data;list_node<T>* _next;list_node<T>* _prev;};template<class T,class Ref,class Ptr>struct list_iterator{typedef list_node<T> Node;typedef list_iterator<T,Ref,Ptr> Self;list_iterator(Node* x):_node(x){}Ref operator*(){return _node->_data;}Ptr operator->(){return &_node->data;}Self& operator++(){_node = _node->_next;return *this;}Self& operator--(){_node = _node->_prev;return *this;}Self operator--(int){Self temp = *this;_node = _node->_prev;return temp;}Self operator++(int){Self temp = *this;_node = _node->_next;return temp;}bool operator==(const Self& x)  const{return _node == x._node;}bool operator!=(const Self& x) const{return _node != x._node;}Node* _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;void empty_init(){_size = 0;_head  = new Node;_head->_next = _head;_head->_prev = _head;}list(){empty_init();}list(const list<T>& x){empty_init();for (const auto& e : x){push_back(e);}}void swap(list<T>& x){std::swap(_size,x._size);std::swap(_head,x._head);}void clear(){iterator it = begin();while (it != end()){it = erase(it);}}list<T>& operator=(list<T> x){swap(x);return *this;}~list(){clear();delete _head;_head = nullptr;}bool empty() const{return  _size == 0;}size_t size() const{return _size;}void push_back(const T& x){Node* newnode = new Node(x);Node* tail = _head->_prev;_head->_prev = newnode;newnode->_next = _head;tail->_next = newnode;newnode->_prev = tail;++_size;}iterator begin(){return _head->_next;}const_iterator begin()  const{return _head->_next; }const_iterator end()  const{return _head;}iterator end(){return _head;}iterator insert(iterator pos,const T& x){Node* newnode = new Node(x);Node* prev = pos._node->_prev;newnode->_next = pos._node;newnode->_prev = prev;prev->_next = newnode;pos._node->_prev = newnode;++_size;return newnode;}void push_front(const T& x){insert(begin(), x);}iterator erase(iterator pos){assert(pos != end());Node* prev = pos._node->_prev;Node* next = pos._node->_next;delete pos._node;prev->_next = next;next->_prev = prev;--_size;return next;}void pop_front(){erase(begin());}void pop_back(){erase(--end());}private:Node* _head;size_t _size;};template<class Container>void print_container(const Container& con){typename Container::const_iterator it = con.begin();while (it != con.end()){   cout << *it << ' ';++it;}cout << endl;for (const auto& e : con){cout << e << ' ';}cout << endl;}void Test(){list<int> lt;lt.push_back(1);lt.push_back(10);lt.push_back(10);lt.push_back(2);lt.push_back(3);lt.erase(lt.begin());print_container(lt);lt.insert(lt.begin(),100);print_container(lt);list<int> lt1 = lt;print_container(lt1);}}

这是一个对于初学者比较友好的简单版本的模拟实现,希望对大家有所帮助。

http://www.dtcms.com/wzjs/608769.html

相关文章:

  • 网站建设工程师培训redis加速wordpress
  • 天津建设公司网站做动态文字的网站
  • 网站兼容工具景点介绍网站模板
  • 搭建网站赚钱吗西宁网站搭建企业
  • 做端口映射 怎么访问网站快手淘客网站是怎么做的
  • 制作微网站的费用国际贸易进口代理公司
  • 网站架构分析网站建设的难处
  • 潮州市网站建设wordpress国内免费模板
  • 网站开发公司的职责做本地房产网站
  • 学做网站从什么开始织梦的网站数据还原怎么做
  • 怎样保存网站资料做证据一般网站建设费用
  • 郑州企业网站托管公司有服务器数据库怎么安装wordpress
  • 百度自己网站排名好的广告片拍摄制作公司
  • 网站群建设 会议 主持中信建设有限责任公司深圳中信金融中心项目工期专业招标
  • 建设企业网站的原因南京seo关键词优化服务
  • 上海博大园林建设发展有限公司网站重庆商城网站开发
  • 重庆网站建设途锦科技网业截屏怎么截
  • 宝安网站建设方案外包app开发制作的基本
  • 龙岗公司做网站最近韩国电影片免费韩国在线观看
  • 网站理念微信网站设计尺寸
  • 网站服务费怎么做凭证网站链接怎么做跳转
  • 学校网站建设意义有哪些帮别人做买家秀的网站
  • 静态网站生成器怎样做随州网站建设价格
  • 怎样建立一个自己的网站动易网站安装子目录中
  • 免费教做面食的网站村网通为每个农村建设了网站
  • 推广网站怎么做知乎巨人科技网站建设
  • 男女做羞羞视频网站网站每年续费给谁
  • 金华网站建设企业如何做网站授权
  • 大型门户网站建设多少钱wordpress 自动更新
  • 泸州免费做网站网站域名备案资料