上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 99 下一页

2011年7月29日

remove_if http://www.cplusplus.com/reference/algorithm/remove_if/

摘要: // remove_if example#include <iostream>#include <algorithm>using namespace std;bool IsOdd (int i) { return ((i%2)==1); }int main () { int myints[] = {1,2,3,4,5,6,7,8,9}; // 1 2 3 4 5 6 7 8 9 // bounds of range: int* pbegin = myints; // ^ int* pend = myints+sizeof(myints)/sizeof(int); // 阅读全文

posted @ 2011-07-29 23:17 more think, more gains 阅读(196) 评论(0) 推荐(0) 编辑

reverse http://www.cplusplus.com/reference/algorithm/reverse/

摘要: // reverse algorithm example#include <iostream>#include <algorithm>#include <vector>using namespace std;int main () { vector<int> myvector; vector<int>::iterator it; // set some values: for (int i=1; i<10; ++i) myvector.push_back(i); // 1 2 3 4 5 6 7 8 9 reverse(myve 阅读全文

posted @ 2011-07-29 23:15 more think, more gains 阅读(168) 评论(0) 推荐(0) 编辑

find_if http://www.cplusplus.com/reference/algorithm/find_first_of/

摘要: // find_if example#include <iostream>#include <algorithm>#include <vector>using namespace std;bool IsOdd (int i) { return ((i%2)==1);}int main () { vector<int> myvector; vector<int>::iterator it; myvector.push_back(10); myvector.push_back(25); myvector.push_back(40); my 阅读全文

posted @ 2011-07-29 23:05 more think, more gains 阅读(130) 评论(0) 推荐(0) 编辑

stable_partition http://www.cplusplus.com/reference/algorithm/stable_partition/

摘要: //通用算法stable_partition的作用是将容器中符合表达式条件的元素全都排列到容器的前半部,并返回最后一个符合项的迭代器地址// stable_partition example#include <iostream>#include <algorithm>#include <vector>using namespace std;bool IsOdd (int i) { return (i%2)==1; }int main () { vector<int> myvector; vector<int>::iterator it 阅读全文

posted @ 2011-07-29 22:58 more think, more gains 阅读(181) 评论(0) 推荐(0) 编辑

equal http://www.cplusplus.com/reference/algorithm/equal/

摘要: // equal algorithm example#include <iostream>#include <algorithm>#include <vector>using namespace std;bool mypredicate (int i, int j) { return (i==j);}int main () { int myints[] = {20,40,60,80,100}; // myints: 20 40 60 80 100 vector<int>myvector (myints,myints+5); // myvector 阅读全文

posted @ 2011-07-29 22:42 more think, more gains 阅读(168) 评论(0) 推荐(0) 编辑

上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 99 下一页

导航