#include<iostream>#include<algorithm>#include<cstdlib>#include <list>/********************************************************迭代器:”可遍历STL容器内全部或部分元素“的对象,一个迭代器用来指出容器中的一个特定位置(标准STL C++ 定义)迭代器是个所谓的smart points ,具有遍历复杂数据结构的能力。其下层运行机制取决于所遍历的数据结构。每一种数据结构必须提供自己迭代器。*********************************************************/
using namespace std;
int main(){ list<char> coll; for(char c='a';c<='z';++c) { coll.push_back(c); } list<char>::const_iterator pos; for(pos=coll.begin(); pos!=coll.end; ++pos ) { cout<<*pos<<' '; } }
return 0;}