#include <list>
#include <iostream>
using namespace std;
int main(int argc, char * argv[])
{
list<int> lst;
for (int i = 0; i < 10; ++i)
lst.push_back(i); //将i推入list<int>
list<int>::iterator it = lst.end();
++it;
cout << *it << endl;
++it;
cout << *it << endl; //移动指针
return 0;
}
$ ./test
0
1
list<string> m_member;
for (i=m_mllist.begin(); i!=m_mllist.end(); ++i)
{
outFile << *i << endl;
fprintf(stderr,"Line=%d,File=%s",__LINE__,__FILE__);
list<string>::const_iterator itr=i->m_member.begin();
fprintf(stderr,"%s",itr->c_str());
}
#include <iostream>
using namespace std;
int main(int argc, char * argv[])
{
list<int> lst;
for (int i = 0; i < 10; ++i)
lst.push_back(i); //将i推入list<int>
list<int>::iterator it = lst.end();
++it;
cout << *it << endl;
++it;
cout << *it << endl; //移动指针
return 0;
}
$ ./test
0
1
list<string> m_member;
for (i=m_mllist.begin(); i!=m_mllist.end(); ++i)
{
outFile << *i << endl;
fprintf(stderr,"Line=%d,File=%s",__LINE__,__FILE__);
list<string>::const_iterator itr=i->m_member.begin();
fprintf(stderr,"%s",itr->c_str());
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/877/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2008-2-5 10:10
评论列表