我正在使用g ++ 4.7.
我想要做的就是这个,
find_if(s.begin(), s.end(), isalnum);
Run Code Online (Sandbox Code Playgroud)
其中isalnum在所定义cctype并且s是一个字符串.
logman.cpp:68:47: error: no matching function for call to ‘find_if(std::basic_string<char>::const_iterator, std::basic_string<char>::const_iterator, <unresolved overloaded function type>)’
Run Code Online (Sandbox Code Playgroud)
但是,这有效,
bool my_isalnum(int c) {
return isalnum(c);
}
find_if(s.begin(), s.end(), my_isalnum);
Run Code Online (Sandbox Code Playgroud)
如何在不创建自己的功能的情况下使其工作?