You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
/*
知识点内容: STL list详解
list是一种序列式容器。list容器完成的功能实际上和数据结构中的双向链表是极其相似的,
list中的数据元素是通过链表指针串连成逻辑意义上的线性表, list不仅是一个双向链表, 而其还是一个环状双向链表。所以它只需要一个指针, 便可以完整实现整个链表。list有一个重要性质: 插入操作( insert) 和合并操作( splice) 都不会 造成原有的list迭代器失效。甚至 list的元素删除操作( erase) 也只有“指向被删除元素”的那个迭代器失效, 其他迭代器不受任何影响。
文档内容参考:
https://www.cnblogs.com/aiguona/p/7231609.html
*/
using namespace std ;
int main ( ) {
list < string > test ;
test . push_back ( " back " ) ; //back
test . push_front ( " middle " ) ; //middle back
test . push_front ( " front " ) ; //front middle back
cout < < test . front ( ) < < endl ; //front
cout < < * test . begin ( ) < < endl ; //front
cout < < test . back ( ) < < endl ; //back
cout < < * ( test . rbegin ( ) ) < < endl ; //back
test . pop_front ( ) ; //middle back
test . pop_back ( ) ; //middle
cout < < test . front ( ) < < endl ; //middle
}