db/upnp/Util: "emplace" items into the list
Reduce overhead.
This commit is contained in:
parent
fd754ff8f8
commit
2722b8a3df
|
@ -107,15 +107,15 @@ stringToTokens(const std::string &str,
|
||||||
|
|
||||||
// Add token to the vector and adjust start
|
// Add token to the vector and adjust start
|
||||||
if (pos == std::string::npos) {
|
if (pos == std::string::npos) {
|
||||||
tokens.push_back(str.substr(startPos));
|
tokens.emplace_back(str, startPos);
|
||||||
break;
|
break;
|
||||||
} else if (pos == startPos) {
|
} else if (pos == startPos) {
|
||||||
// Dont' push empty tokens after first
|
// Dont' push empty tokens after first
|
||||||
if (tokens.empty())
|
if (tokens.empty())
|
||||||
tokens.push_back(std::string());
|
tokens.emplace_back();
|
||||||
startPos = ++pos;
|
startPos = ++pos;
|
||||||
} else {
|
} else {
|
||||||
tokens.push_back(str.substr(startPos, pos - startPos));
|
tokens.emplace_back(str, startPos, pos - startPos);
|
||||||
startPos = ++pos;
|
startPos = ++pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue