From 17f59bf56e8df08595fb2d1fa6f588c2de946e84 Mon Sep 17 00:00:00 2001 From: mistersandman Date: Tue, 15 Jan 2019 11:45:10 +0100 Subject: [PATCH] Use emplace_back instead of push_back --- include/nlohmann/json.hpp | 6 +++--- single_include/nlohmann/json.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index b2b41c76b..b8afa6d37 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1002,7 +1002,7 @@ class basic_json if ((t == value_t::object && !this->object->empty()) || (t == value_t::array && !this->array->empty())) { std::vector> stack; - stack.push_back(std::make_pair(this, t)); + stack.emplace_back(this, t); while (!stack.empty()) { json_value* value; @@ -1016,7 +1016,7 @@ class basic_json value_t inner_type = inner_value.type(); if ((inner_type == value_t::object || inner_type == value_t::array) && !inner_value.empty()) { - stack.push_back(std::make_pair(&inner_value.m_value, inner_type)); + stack.emplace_back(&inner_value.m_value, inner_type); break; } else @@ -1037,7 +1037,7 @@ class basic_json value_t inner_type = inner_value.type(); if ((inner_type == value_t::object || inner_type == value_t::array) && !inner_value.empty()) { - stack.push_back(std::make_pair(&inner_value.m_value, inner_type)); + stack.emplace_back(&inner_value.m_value, inner_type); break; } else diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a90ae2736..6f6515cad 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -13470,7 +13470,7 @@ class basic_json if ((t == value_t::object && !this->object->empty()) || (t == value_t::array && !this->array->empty())) { std::vector> stack; - stack.push_back(std::make_pair(this, t)); + stack.emplace_back(this, t); while (!stack.empty()) { json_value* value; @@ -13484,7 +13484,7 @@ class basic_json value_t inner_type = inner_value.type(); if ((inner_type == value_t::object || inner_type == value_t::array) && !inner_value.empty()) { - stack.push_back(std::make_pair(&inner_value.m_value, inner_type)); + stack.emplace_back(&inner_value.m_value, inner_type); break; } else @@ -13505,7 +13505,7 @@ class basic_json value_t inner_type = inner_value.type(); if ((inner_type == value_t::object || inner_type == value_t::array) && !inner_value.empty()) { - stack.push_back(std::make_pair(&inner_value.m_value, inner_type)); + stack.emplace_back(&inner_value.m_value, inner_type); break; } else