loolwsd/AdminModel.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
New commits: commit 3731f0c0d79f43788507d1516df7c82ac6318aee Author: Pranav Kant <pran...@collabora.com> Date: Thu Mar 10 17:59:55 2016 +0530 loolwsd: Avoid unnecessary copying Change-Id: Iff888e5ff4577f20fae63a7b62ab1481ea2d71ed diff --git a/loolwsd/AdminModel.hpp b/loolwsd/AdminModel.hpp index e94fbbf..0d9f21c 100644 --- a/loolwsd/AdminModel.hpp +++ b/loolwsd/AdminModel.hpp @@ -84,8 +84,7 @@ public: void addView(int nSessionId) { - std::pair<std::map<int, View>::iterator, bool > ret; - ret = _views.insert(std::pair<int, View>(nSessionId, View(nSessionId))); + const auto ret = _views.emplace(nSessionId, View(nSessionId)); if (!ret.second) { Log::warn() << "View with SessionID [" + std::to_string(nSessionId) + "] already exists." << Log::end; @@ -287,7 +286,7 @@ public: void subscribe(int nSessionId, std::shared_ptr<Poco::Net::WebSocket>& ws) { - auto ret = _subscribers.insert(std::pair<int, Subscriber>(nSessionId, Subscriber(nSessionId, ws))); + const auto ret = _subscribers.emplace(nSessionId, Subscriber(nSessionId, ws)); if (!ret.second) { Log::warn() << "Subscriber already exists" << Log::end; @@ -317,8 +316,7 @@ private: // Prolly, *move* expired documents to another container (?) void addDocument(Poco::Process::PID pid, std::string url) { - std::pair<std::map<Poco::Process::PID, Document>::iterator, bool > ret; - ret = _documents.insert(std::pair<Poco::Process::PID, Document>(pid, Document(pid, url))); + const auto ret = _documents.emplace(pid, Document(pid, url)); if (!ret.second) { Log::warn() << "Document with PID [" + std::to_string(pid) + "] already exists." << Log::end; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits