'Can anyone explain this code? I do not understand the working of not1() and ptr_fun()
Can anyone explain the working of this function?
string rightTrim(const string &str)
{
string s(str);
s.erase(find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(), s.end());
return s;
}
I don't know the working of not1() and ptr_fun(). Can anyone provide me with a good explanation for this code?
PS: I know, this code removes any white spaces from the end of the string.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
