if (ret < 0) {
return ret;
}
- for(list<string>::iterator iter = raw_periods.begin(); iter != raw_periods.end(); iter++) {
- size_t pos = iter->find(".");
- if ( pos != std::string::npos) {
- periods.push_back(iter->substr(0, pos));
+ for (const auto& oid : raw_periods) {
+ size_t pos = oid.find(".");
+ if (pos != std::string::npos) {
+ periods.push_back(oid.substr(0, pos));
} else {
- periods.push_back(*iter);
+ periods.push_back(oid);
}
}
+ periods.sort(); // unique() only detects duplicates if they're adjacent
periods.unique();
return 0;
}