33 #ifndef __H__UG_index_list_util
34 #define __H__UG_index_list_util
44 template <
class ind_t>
50 for(
size_t i = 0; i < inds.size(); ++i)
55 const ind_t first = inds[i];
57 while((i + 1 < inds.size()) && inds[i+1] == cur + 1){
64 else if(first + 1 == cur)
65 ss << first <<
"," << cur;
67 ss << first <<
"-" << cur;
75 template <
class ind_t>
80 const char* cur = rangeString;
82 bool readingRange =
false;
87 while(*cur && *cur !=
',' && *cur !=
'-'){
89 ind = ind * 10 + *cur -
'0';
95 for(ind_t i = lastInd; i <= ind; ++i)
96 indsOut.push_back (i);
100 case 0: indsOut.push_back(ind);
break;
101 case ',': indsOut.push_back(ind);
break;
102 case '-': lastInd = ind; readingRange =
true;
break;
Definition: smart_pointer.h:814
void RangeStringToIndexList(std::vector< ind_t > &indsOut, const char *rangeString)
Definition: index_list_util.h:76
std::string IndexListToRangeString(const std::vector< ind_t > &inds)
Definition: index_list_util.h:45