Clarify "breaker" -> regex "pattern"

This commit is contained in:
John 2022-04-22 23:39:18 -05:00
parent 710807dde7
commit bddc486aeb

View File

@ -74,8 +74,8 @@ void graph::read(std::string filename) {
std::vector<int> stovi (const std::string &s) { std::vector<int> stovi (const std::string &s) {
// Create the number classifier // Create the number classifier
std::regex breaker("[0-9]+"); std::regex pattern("[0-9]+");
std::sregex_token_iterator first{s.begin(), s.end(), breaker, 0}, last; std::sregex_token_iterator first{s.begin(), s.end(), pattern, 0}, last;
// Match the numbers // Match the numbers
std::vector<int> res; std::vector<int> res;
for (auto i = first; i != last; ++i) res.push_back(atoi(i->str().c_str())); for (auto i = first; i != last; ++i) res.push_back(atoi(i->str().c_str()));