From 2722b8a3df356bdb36fe498fb2bbc709e5ae4bc1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Jan 2014 09:40:30 +0100 Subject: db/upnp/Util: "emplace" items into the list Reduce overhead. --- src/db/upnp/Util.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/db/upnp') diff --git a/src/db/upnp/Util.cxx b/src/db/upnp/Util.cxx index 383e23074..9b223aca9 100644 --- a/src/db/upnp/Util.cxx +++ b/src/db/upnp/Util.cxx @@ -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; } } -- cgit v1.2.3