I was just talking with a friend about what would be the most efficient way to check if a std::string has only spaces. He needs to do this on an embedded project he is worki
In C++11, the all_of algorithm can be employed:
all_of
// Check if s consists only of whitespaces bool whiteSpacesOnly = std::all_of(s.begin(),s.end(),isspace);