C ++ 0x introduces three algorithms, you can check: all_of, any_ofand none_of.
#include <algorithm>
#include <functional>
for (vector<string>::size_type i = 0; i < words.size(); ++i)
{
if (any_of(disliked.begin(),
disliked.end(),
bind2nd(equal_to<string>(), words[i])))
{
cout << "BLEEP" << " ";
}
else
{
cout << words[i] << " ";
}
}
, , , , std::set. binary_search , .
( , int vector<string>::size_type.)