distance
// distance example
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main () {
list<int> mylist;
for (int i=0; i<10; i++) mylist.push_back (i*10);
list<int>::iterator first = mylist.begin();
list<int>::iterator last = mylist.end();
cout << "The distance is: " << distance(first,last) << endl;
return 0;
}
posted on 2011-07-29 23:29 more think, more gains 阅读(136) 评论(0) 编辑 收藏 举报