函数对象的函数适配器(2)

vector<int>::iterator ite = ivec.begin();
  while((ite = find_if(ite, ivec.end(), bind2nd(greater<int>(), 5))) != ivec.end())
  {
    cout << *ite << " ";
    ite++;
  }
  cout << endl;

sort(ivec.begin(), ivec.end(), greater<int>());
  while(ite != ivec.end())
  {
    cout << *ite << " ";
    ite++;
  }
  cout << endl;
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/4a9a86f848a8eab071ca3ba32f0dea18.html