Skip to content
Snippets Groups Projects
Commit dc7f8e73 authored by Antti Soininen's avatar Antti Soininen
Browse files

MultiFileNameParser: simplify emplace_back calls. Re #22597

parent 46a6eebc
No related merge requests found
...@@ -446,12 +446,8 @@ void RunRangeList::addRunRange( ...@@ -446,12 +446,8 @@ void RunRangeList::addRunRange(
namespace // anonymous namespace // anonymous
{ {
/** /**
* Parses a string containing a run "token". * Parses a string containing a run "token" and adds the runs to the parsedRuns
* * vector.
* Note that this function takes the form required by the "accumulate"
*algorithm:
* it takes in the parsed runs so far and a new token to parse, and then returns
* the result of appending the newly parsed token to the already parsed runs.
* *
* @param parsedRuns :: the vector of vectors of runs parsed so far. * @param parsedRuns :: the vector of vectors of runs parsed so far.
* @param token :: the token to parse. * @param token :: the token to parse.
...@@ -581,11 +577,11 @@ generateRange(unsigned int const from, unsigned int const to, ...@@ -581,11 +577,11 @@ generateRange(unsigned int const from, unsigned int const to,
while (currentRun <= to) { while (currentRun <= to) {
if (addRuns) { if (addRuns) {
if (runs.empty()) if (runs.empty())
runs.emplace_back(std::vector<unsigned int>(1, currentRun)); runs.emplace_back(1, currentRun);
else else
runs.front().emplace_back(currentRun); runs.front().emplace_back(currentRun);
} else { } else {
runs.emplace_back(std::vector<unsigned int>(1, currentRun)); runs.emplace_back(1, currentRun);
} }
currentRun += stepSize; currentRun += stepSize;
...@@ -596,11 +592,11 @@ generateRange(unsigned int const from, unsigned int const to, ...@@ -596,11 +592,11 @@ generateRange(unsigned int const from, unsigned int const to,
while (currentRun >= to) { while (currentRun >= to) {
if (addRuns) { if (addRuns) {
if (runs.empty()) if (runs.empty())
runs.emplace_back(std::vector<unsigned int>(1, currentRun)); runs.emplace_back(1, currentRun);
else else
runs.front().emplace_back(currentRun); runs.front().emplace_back(currentRun);
} else { } else {
runs.emplace_back(std::vector<unsigned int>(1, currentRun)); runs.emplace_back(1, currentRun);
} }
// Guard against case where stepSize would take us into negative // Guard against case where stepSize would take us into negative
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment