I'm writing a program to parse a logfile, and decided to be as C++ about that as possible and I got hit with debug assertion for this line -
sLine.erase(remove_if(sLine.begin(), sLine.end(), isspace), sLine.end());
Which seems to because of a character of value -80 at like, 2000th line of the logfile.
So, I tried this
sLine.erase(remove_if(sLine.begin(), sLine.end(), [](char c) { return c >= -1 && c<=255; }), sLine.end());
But this code snippet gets stuck with no explanation.
So, finally I have three questions -
Thanks for any help!
The following code will work if you just want to erase space characters
sLine.erase(std::remove_if(sLine.begin(), sLine.end(), [](char c) { return (c == ' '); }), sLine.end());