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
|
||||
if (pos == std::string::npos) {
|
||||
tokens.push_back(str.substr(startPos));
|
||||
tokens.emplace_back(str, startPos);
|
||||
break;
|
||||
} else if (pos == startPos) {
|
||||
// Dont' push empty tokens after first
|
||||
if (tokens.empty())
|
||||
tokens.push_back(std::string());
|
||||
tokens.emplace_back();
|
||||
startPos = ++pos;
|
||||
} else {
|
||||
tokens.push_back(str.substr(startPos, pos - startPos));
|
||||
tokens.emplace_back(str, startPos, pos - startPos);
|
||||
startPos = ++pos;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue