I need to convert const_iterator into a type that I can do int and string operations to.
results[1] contains the text from the regex_search that I need to work with.
I’ve spent a couple hours already trying cast into a workable format, no success…
boost::match_results<std::string::const_iterator> results;
boost::regex ex(pattern, boost::regex::perl);
if(boost::regex_search(line, results, ex))
(results[1] > 10) ? cout << "Fail" : cout << "Pass";
Thanks,
Joe
You could create an
std::stringout of a match result of const string iterators like this:…or simply:
You can coerce the string to an
intlike this:…or, as pointed by @Jonathan Wakely, if you are using C++11: