| 32 | // 'values'. |
| 33 | template <typename T> |
| 34 | bool SplitAndParse(const std::string& str, char delim, std::vector<T>* values) { |
| 35 | std::istringstream input(str); |
| 36 | for (std::string line; std::getline(input, line, delim);) { |
| 37 | std::istringstream to_parse(line); |
| 38 | T val; |
| 39 | to_parse >> val; |
| 40 | if (!to_parse.eof() && !to_parse.good()) { |
| 41 | return false; |
| 42 | } |
| 43 | values->emplace_back(val); |
| 44 | } |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | } // namespace util |
| 49 | } // namespace benchmark |