STL之list

list传送门

一、LRU

二、list常用成员函数

(1)Iterators:迭代器

begin //返回begin处的迭代器
Return iterator to beginning (public member function )
end  //返回end处的迭代器
Return iterator to end (public member function )
rbegin    //LRU设计数据结构中使用了
Return reverse iterator to reverse beginning (public member function )
rend
Return reverse iterator to reverse end (public member function )

(2)Capacity:容量

empty //判断双向链表是否是空的
Test whether container is empty (public member function )
size    //设计LRU的时候使用了
Return size (public member function )
max_size    //大小
Return maximum size (public member function )

(3)Element access:元素访问

front    //头结点
Access first element (public member function )
back    //尾结点
Access last element (public member function )

(4)Modifiers:修饰语

assign
Assign new content to container (public member function )
emplace_front 
Construct and insert element at beginning (public member function )
push_front    //往开头插入结点
Insert element at beginning (public member function )
pop_front    //删掉开头的节点
Delete first element (public member function )
emplace_back 
Construct and insert element at the end (public member function )
push_back    //往尾巴处插入结点
Add element at the end (public member function )
pop_back    //删掉尾巴的节点
Delete last element (public member function )
emplace 
Construct and insert element (public member function )
insert    //插入元素
Insert elements (public member function )
erase    //删掉元素,LRU使用了
Erase elements (public member function )
swap
Swap content (public member function )
resize
Change size (public member function )
clear
Clear content (public member function )

(5)Operations:

splice
Transfer elements from list to list (public member function )
remove
Remove elements with specific value (public member function )
remove_if
Remove elements fulfilling condition (public member function template )
unique
Remove duplicate values (public member function )
merge
Merge sorted lists (public member function )
sort
Sort elements in container (public member function )
reverse
Reverse the order of elements (public member function )

Observers:
get_allocator
Get allocator (public member function )