| 132 | } |
| 133 | |
| 134 | std::vector<int> parse_thread_counts(const std::string& raw) |
| 135 | { |
| 136 | std::vector<int> values; |
| 137 | std::stringstream ss(raw); |
| 138 | std::string token; |
| 139 | |
| 140 | while(std::getline(ss, token, ',')) |
| 141 | { |
| 142 | if(token.empty()) |
| 143 | { |
| 144 | continue; |
| 145 | } |
| 146 | |
| 147 | int value = std::stoi(token); |
| 148 | if(value <= 0) |
| 149 | { |
| 150 | throw std::runtime_error("--threads must contain positive integers"); |
| 151 | } |
| 152 | values.push_back(value); |
| 153 | } |
| 154 | |
| 155 | if(values.empty()) |
| 156 | { |
| 157 | throw std::runtime_error("--threads must contain at least one value"); |
| 158 | } |
| 159 | |
| 160 | return values; |
| 161 | } |
| 162 | |
| 163 | bool parse_bool(const std::string& raw) |
| 164 | { |