I've got data in a string, and I'd like to remove all spaces and newlines in the simplest way possible. I was wondering if there is a list of STL Predicates somewhere that I could use, or if there is a better way. Here is what I'm currently doing:
string buf;
//load data into buf
remove_if(buf.begin(), buf.end(), isspace);
However, after this line is executed, my string still contains a newline(ascii 10) followed by a space (32).
std::remove and std:;remove_if do not remove elements from a sequence. You should use member function erase with the algorithms to remove characters from a string.