使用bind()函数为find_if()传递参数
bool check_size(string s, int sz) { return s.size() >= sz; } int main() { vector<string> strs = { "axx", "css", "bww", "ssdde", "awweerf" }; int sz = 4; auto f1 = bind(check_size, placeholders::_1, placeholders::_2); auto wc = find_if(strs.begin(), strs.end(), bind(check_size, placeholders::_1, sz)); cout << *wc; return 0; }