/*
*
********************************************
* list双向链表容器的基础说明:
********************************************
*
* list双向链表容器采用双向链表的数据结构来存储元素数据,可以高效查找、插入、删除容器元素
*
* Reversibe Container Back Insertion Sequence Front Insertion Sequence
* 不同于vector,list查找、插入、删除元素的时间复杂度均为O(1)
*
* 使用list必须使用宏语句#include <list>
*
**************************************************************************************
*
* 创建list对象:
* 1.list<int> a;
* 2.list<int> a(10); //具有10个元素的对象a,每个元素默认值为0
* 3.list<char> a(5,'k');
* 4.list<char> b(a); //list<char> c(a.begin(),a.end())
*
**************************************************************************************
*
* 初始化赋值
* void push_back(const T& value)
*
**************************************************************************************
*
* 遍历访问
* iterator begin() //只能使用迭代器的方式进行遍历
* iterator end()
* iterator rbegin(); //反向遍历
* iterator rbegin();
*
**************************************************************************************
*
* 常用函数
*
* bool empty();
*
* void pop_front(); void pop_back();
*
* void push_front(const T&); void push_back(
C++ STL学习笔记四 list双向链表容器
最新推荐文章于 2024-04-20 11:40:27 发布