I am using std::ptr_fun
as follows:
static inline std::string <rim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
as presented in this answer.
However this does not compile with C++17 (using Microsoft Visual Studio 2017), with the error:
error C2039: 'ptr_fun': is not a member of 'std'
How can this be fixed?
You use a lambda:
static inline std::string <rim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) {return !std::isspace(c);}));
return s;
}
The answer you cited is from 2008, well before C++11 and lambdas existed.