D
DavidW
Hello,
Is the function below the simplest way to produce an iterator to the next
non-space in a string? (Or the upper-bound iterator if none is found).
Searching for a sequence is overkill and inefficient IMO.
#include <string>
#include <algorithm>
#include <functional>
std::string::iterator find_not_space(std::string &s)
{
char chSpace = ' ';
return std::search(s.begin(), s.end(), &chSpace , &chSpace+1,
std::not_equal_to<char>());
}
Is the function below the simplest way to produce an iterator to the next
non-space in a string? (Or the upper-bound iterator if none is found).
Searching for a sequence is overkill and inefficient IMO.
#include <string>
#include <algorithm>
#include <functional>
std::string::iterator find_not_space(std::string &s)
{
char chSpace = ' ';
return std::search(s.begin(), s.end(), &chSpace , &chSpace+1,
std::not_equal_to<char>());
}