cfs/src/perfutil/Util.cc
/**
 * Take a string containing comma-separated ranges of integers and return an
 * std::vector containing the numbers in each range.
 */
Take a string containing comma-separated ranges of integers and return an
std::vector containing the numbers in each range.
Take a string containing comma - separated ranges of integers and return an std :: vector containing the numbers in each range .
std::vector<int>
parseRanges(const char* coreDesc) {
  std::vector<int> cores;
  std::vector<std::string> ranges = split(coreDesc, ',');
  for (size_t i = 0; i < ranges.size(); i++) {
    if (ranges[i].find("-") == std::string::npos) {
      cores.push_back(atoi(ranges[i].c_str()));
    } else {
      auto bounds = split(ranges[i], '-');
      for (int k = atoi(bounds[0].c_str()); k <= atoi(bounds[1].c_str());
           k++)
        cores.push_back(k);
    }
  }
  return cores;
}
std :: vector < int > parseRanges ( const char * coreDesc ) { std :: vector < int > cores ; std :: vector < std :: string > ranges = split ( coreDesc , ' ' ) ; for ( size_t i = 0 ; i < ranges . size ( ) ; i ++ ) { if ( ranges [ i ] . find ( " " ) == std :: string :: npos ) { cores . push_back ( atoi ( ranges [ i ] . c_str ( ) ) ) ; } else { auto bounds = split ( ranges [ i ] , ' ' ) ; for ( int k = atoi ( bounds [ 0 ] . c_str ( ) ) ; k <= atoi ( bounds [ 1 ] . c_str ( ) ) ; k ++ ) cores . push_back ( k ) ; } } return cores ; }
Take a string containing comma-separated ranges of integers and return an
 std::vector containing the numbers in each range.
Take a string containing comma - separated ranges of integers and return an std :: vector containing the numbers in each range .