Mega Code Archive

 
Categories / C++ Tutorial / STL Algorithms Helper
 

Use not2() to remove all characters that are not equal to H

#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; }