Use not2() to remove all characters that are not equal to H : not1 « STL Algorithms Helper « C++ Tutorial






#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
  vector<char> v;

  for(int i=0; i < 26; i++) 
     v.push_back('A'+i);

  vector<char>::iterator res_end;
  res_end = remove_if(v.begin(), v.end(),not1(bind2nd(equal_to<char>(), 'H')));

  return 0;
}








32.17.not1
32.17.1.Use not1() to reverse sort v
32.17.2.Use not2() to remove all characters that are not equal to H
32.17.3.negators with find_if, not1, greater_equals