c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

一 :容器的类型和使用规则

**(1)**容器的种类
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(2)容器的选择方式
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(3)容器支持的操作
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

二:迭代器概念

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

三:容器的定义和初始化

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(1)容器的赋值运算
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
**

四:容器的大小操作**

每个容器类型都支持相等运算符(=和!=);****除了无序关联容器外的所有容器都支持关系运算符**(>、>=、<、<=)。关系运算符左右两边的运算对象必须是相同类型的容器,**
且必须保存相同类型的元素。即,我们只能将一个vector与另一个vector进行比较,**而不能将-一个vector与一个list或一个vector**进行比较。

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

五:向顺序容器添加元素的操作

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

六:在顺序容器访问元素的操作

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

七:顺序容器中的删除操作

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

八:forward_list独有的操作

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

九:顺序容器大小的操作

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

十:迭代器失效的情况

insert or erasevectorstring容器还有容量,则插入点之前的迭代器,指针,引用有效
对list和forward_list无影响
insert deque 首尾会使迭代器失效,其他有效。首尾之外全部无效
erase deque 会使end()失效,其他无影响,erase 首无影响,首尾之外全部无效。
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

十一:string的用法补充

(1)string的构造
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(2)字符串的拆分
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(3)string的修改操作
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(4)string的find 家族
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(5)string的compare函数
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
(6)string和数值之间的转换
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

十二:容器共有的适配器**

c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则
c++中forward_list,list,deque,vector,string,等顺序容器的使用简则

以上整理自《c++primer 5th》