#include #include #include #include #include template struct not_fn_ { Fun const &d_fun; not_fn_(Fun const &fun) : d_fun(fun) {} template bool operator()(ParTypes && ...types) { return not d_fun(std::forward(types)...); } }; template not_fn_ not_fn(Fun const &fun) { return not_fn_(fun); } using namespace std; using namespace placeholders; //main int main() { vector vs {"a", "a", "b"}; string reftext {"b"}; cout << count_if(vs.begin(), vs.end(), bind(not_fn(equal_to()), _1, reftext)) << '\n' << count_if(vs.begin(), vs.end(), not_fn(bind(equal_to(), _1, reftext))) << '\n'; } //=