From 7c1f95e850338e518ceae3fb92cfb3272c8ecafd Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 15 Jul 2022 12:47:08 +0200 Subject: [PATCH] Util: Prevent unnecessary copy assignment calls --- src/util/json/parser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/json/parser.cpp b/src/util/json/parser.cpp index ffdeb88..f92b466 100644 --- a/src/util/json/parser.cpp +++ b/src/util/json/parser.cpp @@ -448,19 +448,19 @@ Value Parser::getObject() // Add member (name:value pair) to object token = peek(); if (token.type == Token::Type::Literal) { - object[name] = getLiteral(); + object.emplace(name, getLiteral()); } else if (token.type == Token::Type::Number) { - object[name] = getNumber(); + object.emplace(name, getNumber()); } else if (token.type == Token::Type::String) { - object[name] = getString(); + object.emplace(name, getString()); } else if (token.type == Token::Type::BracketOpen) { - object[name] = getArray(); + object.emplace(name, getArray()); } else if (token.type == Token::Type::BraceOpen) { - object[name] = getObject(); + object.emplace(name, getObject()); } else { reportError(token, "expecting value, not '" + token.symbol + "'");