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 -
- Why is that debug assertion is required?
- What is the reason for the second code snippet to fail?
- Any workarounds you could suggest?
Thanks for any help!