std::pairoverloads operator==, so you can use std::findfor affirmative:
bool b = std::find(v.begin(), v.end(), std::make_pair(false, false)) == v.end();
and you can use std::find_iffor negative:
bool b = std::find_if(v.begin(), v.end(),
std::bind2nd(std::not_equal_to<std::pair<bool, bool> >(),
std::make_pair(false, false)))
!= v.end();
The second can be written much more purely in C ++ 0x:
bool b = std::find_if(v.begin(), v.end(),
[](const std::pair<bool, bool> p) {
return p != std::make_pair(false, false);
}) != v.end();
source
share