标签:
#include <iostream> #include <algorithm> #include <list> using namespace std; //using namespace std::list; //using namespace std::cout; //using namespace std::endl; int main(int argc, char** argv) { typedef list<int> IntList; IntList coll; for(int i=20; i<40; ++i) { coll.push_back(i); } list<int>::iterator pos25, pos35; pos25 = find(coll.begin(), coll.end(), 25); cout<<*pos25<<endl; // 25 pos35 = find(coll.begin(), coll.end(), 35); cout<<*pos35<<endl; // 35 // 注意:max_element返回的值是34,而不是35. cout<<"max = "<< *max_element(pos25, pos35)<<endl; return 0; }
标签:
原文地址:http://www.cnblogs.com/sylar-liang/p/4330531.html