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

在线设计海报网站邢台网站推广多少钱

在线设计海报网站,邢台网站推广多少钱,王也天演过的电视剧,要怎么推广网站#x1f4d8;北尘_#xff1a;个人主页 #x1f30e;个人专栏:《Linux操作系统》《经典算法试题 》《C》 《数据结构与算法》 ☀️走在路上#xff0c;不忘来时的初心 文章目录 一、 list的介绍二、list的模拟实现1、list的节点2、list 的迭代器3、list4、打印5、完整代码… 北尘_个人主页 个人专栏:《Linux操作系统》《经典算法试题 》《C》 《数据结构与算法》 ☀️走在路上不忘来时的初心 文章目录 一、 list的介绍二、list的模拟实现1、list的节点2、list 的迭代器3、list4、打印5、完整代码 一、 list的介绍 list是可以在常数范围内在任意位置进行插入和删除的序列式容器并且该容器可以前后双向迭代。list的底层是双向链表结构双向链表中每个元素存储在互不相关的独立节点中在节点中通过指针指向其前一个元素和后一个元素。list与forward_list非常相似最主要的不同在于forward_list是单链表只能朝前迭代已让其更简单高效。与其他的序列式容器相比(arrayvectordeque)list通常在任意位置进行插入、移除元素的执行效率更好。与其他序列式容器相比list和forward_list最大的缺陷是不支持任意位置的随机访问比如要访问list的第6个元素必须从已知的位置(比如头部或者尾部)迭代到该位置在这段位置上迭代需要线性的时间开销list还需要一些额外的空间以保存每个节点的相关联信息(对于存储类型较小元素的大list来说这可能是一个重要的因素) 二、list的模拟实现 1、list的节点 templateclass Tstruct list_node{T _data;list_nodeT* _prev;list_nodeT* _next;list_node(const T x T()):_data(x), _next(nullptr), _prev(nullptr){}};2、list 的迭代器 templateclass T, class Ref, class Ptrstruct __list_iterator{typedef list_nodeT Node;typedef __list_iteratorT, Ref, Ptr self;Node* _node;__list_iterator(Node* node):_node(node){}self operator(){_node _node-_next;return *this;}self operator--(){_node _node-_prev;return *this;}self operator(int){self tmp(*this);_node _node-_next;return tmp;}self operator--(int){self tmp(*this);_node _node-_prev;return tmp;}Ref operator*(){return _node-_data;}Ptr operator-(){return _node-_data;}bool operator!(const self s){return _node ! s._node;}bool operator(const self s){return _node s._node;}};3、list templateclass Tclass list{typedef list_nodeT Node;public:typedef __list_iteratorT, T, T* iterator;typedef __list_iteratorT, const T, const T* const_iterator;iterator begin(){return _head-_next;}iterator end(){return _head;}const_iterator begin() const{return _head-_next;}const_iterator end() const{return _head;}void empty_init(){_head new Node;_head-_next _head;_head-_prev _head;_size 0;}list(){empty_init();}list(listT lt){empty_init();for (auto e : lt){push_back(e);}}listT operator(listT lt){swap(lt);return *this;}void swap(listT lt){std::swap(_size, lt._size);std::swap(_head, lt._head);}iterator insert(iterator pos, const T x){Node* cur pos._node;Node* newnode new Node(x);Node* prev cur-_prev;prev-_next newnode;newnode-_prev prev;newnode-_next cur;cur-_prev newnode;_size;return iterator(newnode);}iterator erase(iterator pos){Node* cur pos._node;Node* prev cur-_prev;Node* next cur-_next;delete cur;prev-_next next;next-_prev prev;--_size;}size_t size(){return _size;}void clear(){iterator it begin();while (it ! end){it erase(it);}}void push_back(const T x){insert(end(), x);}void push_front(const T x){insert(begin(), x);}void push_back(){erase(end());}void pop_back(){erase(begin());}private:Node* _head;size_t _size;};4、打印 templatetypename Containervoid print_container(const Container con){typename Container::const_iterator it con.begin();while (it ! con.end()){cout *it ;it;}cout endl;}void test_list(){listint lt;lt.push_back(1);lt.push_back(2);lt.push_back(3);lt.push_back(4);lt.push_back(5);print_container(lt);liststring lt1;lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);print_container(lt1);vectorstring v;v.push_back(222222222222222222222);v.push_back(222222222222222222222);v.push_back(222222222222222222222);v.push_back(222222222222222222222);print_container(v);} } int main() {bit::test_list();return 0; }5、完整代码 #includeiostream #includestring #includevector using namespace std; namespace bit {templateclass Tstruct list_node{T _data;list_nodeT* _prev;list_nodeT* _next;list_node(const T x T()):_data(x), _next(nullptr), _prev(nullptr){}};templateclass T, class Ref, class Ptrstruct __list_iterator{typedef list_nodeT Node;typedef __list_iteratorT, Ref, Ptr self;Node* _node;__list_iterator(Node* node):_node(node){}self operator(){_node _node-_next;return *this;}self operator--(){_node _node-_prev;return *this;}self operator(int){self tmp(*this);_node _node-_next;return tmp;}self operator--(int){self tmp(*this);_node _node-_prev;return tmp;}Ref operator*(){return _node-_data;}Ptr operator-(){return _node-_data;}bool operator!(const self s){return _node ! s._node;}bool operator(const self s){return _node s._node;}};templateclass Tclass list{typedef list_nodeT Node;public:typedef __list_iteratorT, T, T* iterator;typedef __list_iteratorT, const T, const T* const_iterator;iterator begin(){return _head-_next;}iterator end(){return _head;}const_iterator begin() const{return _head-_next;}const_iterator end() const{return _head;}void empty_init(){_head new Node;_head-_next _head;_head-_prev _head;_size 0;}list(){empty_init();}list(listT lt){empty_init();for (auto e : lt){push_back(e);}}listT operator(listT lt){swap(lt);return *this;}void swap(listT lt){std::swap(_size, lt._size);std::swap(_head, lt._head);}iterator insert(iterator pos, const T x){Node* cur pos._node;Node* newnode new Node(x);Node* prev cur-_prev;prev-_next newnode;newnode-_prev prev;newnode-_next cur;cur-_prev newnode;_size;return iterator(newnode);}iterator erase(iterator pos){Node* cur pos._node;Node* prev cur-_prev;Node* next cur-_next;delete cur;prev-_next next;next-_prev prev;--_size;}size_t size(){return _size;}void clear(){iterator it begin();while (it ! end){it erase(it);}}void push_back(const T x){insert(end(), x);}void push_front(const T x){insert(begin(), x);}void push_back(){erase(end());}void pop_back(){erase(begin());}private:Node* _head;size_t _size;};templatetypename Containervoid print_container(const Container con){typename Container::const_iterator it con.begin();while (it ! con.end()){cout *it ;it;}cout endl;}void test_list(){listint lt;lt.push_back(1);lt.push_back(2);lt.push_back(3);lt.push_back(4);lt.push_back(5);print_container(lt);liststring lt1;lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);lt1.push_back(1111111111111);print_container(lt1);vectorstring v;v.push_back(222222222222222222222);v.push_back(222222222222222222222);v.push_back(222222222222222222222);v.push_back(222222222222222222222);print_container(v);} } int main() {bit::test_list();return 0; }
http://wiki.neutronadmin.com/news/125044/

相关文章:

  • 做网站用的系统wordpress如何输入拼音
  • 简单详细搭建网站教程视频教程公司网站建设youyi51
  • 平台网站怎么做的好企业网络推广价格
  • 湛江市seo网站设计报价太原建设北路小学网站
  • 百度站长平台安卓版search and replace wordpress
  • 旅游网站wordpress常州百度公司
  • 好看的学校网站模板怎么查询网站备案
  • 郑州营销网站托管网络运营中心
  • 沈阳做网站seo北京高端建设网站
  • 找人做网站内容自己编辑吗wordpress 离线编辑器
  • 搭建租号网的网站网站项目流程
  • 实用网站建设wordpress显示浏览次数
  • 英文网站提交有了网站源码如何做网页
  • 如何在解决方案中新建网站手机app界面设计分析
  • 北京网站建设公司费用网站建设经验王者荣耀恺和
  • 用vs2010做网站论文短视频app用户量排行榜
  • linux系统服务器怎么做网站湛江麻章区
  • 建设学生社团网站的可行性分析云服务器价格
  • 公司网站怎么推广上海做电子商务网站的公司
  • 建设银行兰州分行网站电子商务服务平台
  • 手机网站页面模板天津创思佳网络网站制作公司
  • .net网站开发简介wordpress扒主题
  • 一个网站seo做哪些工作内容佛山网站建设明细
  • 大连百度做网站推广电话软件开发的职业规划1000
  • 服装东莞网站建设良品铺子网站建设设计
  • 种子搜索网站怎么做的修机械师怎么做我小样网站角仰望
  • 网络营销导向的企业网站建设的要求WordPress文章怎么折叠
  • 安阳哪里有学做网站的学校好的宠物网站模板
  • 鲜花网站建设文档苏州网页服务开发与网站建设
  • 网站带支付源码ih5网站制作平台