#include<list>
#include<string>
#include<iostream>
using namespace std; int main()
{
list<string> ltStr;
ltStr.push_back("hello"); //非指针类型
list<string>::iterator iter = ltStr.begin(); //指向string列表的指针:指针的好处:传进去时不用复制一份副本
list<string> *p = &ltStr;
//iterator类型不变,但用的是p->begin()
list<string>::iterator iter1 = p->begin();
cout << *iter << endl;
cout << *iter1 << endl; return ;
} const list<string>* markets
list<string>::const_iterator citer = markets->begin();//const_iterator:指向常量的iterator,不能用普通的iterator。
05-08 15:51