summaryrefslogtreecommitdiffstats
path: root/Source/cmJSONState.cxx
diff options
context:
space:
mode:
authorRose <83477269+AtariDreams@users.noreply.github.com>2023-10-16 23:43:13 (GMT)
committerBrad King <brad.king@kitware.com>2023-10-23 15:18:32 (GMT)
commit9ca6dfc280b086fcf139f631f294281e234f5752 (patch)
treea5c60e2d93b8c4ad6a56eb28a0aeabb8bca404cf /Source/cmJSONState.cxx
parentaaeb2e0aa868af3cfe927e1ff8c79faa8bdcf28f (diff)
downloadCMake-9ca6dfc280b086fcf139f631f294281e234f5752.zip
CMake-9ca6dfc280b086fcf139f631f294281e234f5752.tar.gz
CMake-9ca6dfc280b086fcf139f631f294281e234f5752.tar.bz2
Source: Reduce vector entry allocations and copies
Prefer `emplace_back` over `push_back`.
Diffstat (limited to 'Source/cmJSONState.cxx')
-rw-r--r--Source/cmJSONState.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmJSONState.cxx b/Source/cmJSONState.cxx
index 1abdaa6..5c44fba 100644
--- a/Source/cmJSONState.cxx
+++ b/Source/cmJSONState.cxx
@@ -45,7 +45,7 @@ cmJSONState::cmJSONState(const std::string& filename, Json::Value* root)
void cmJSONState::AddError(std::string const& errMsg)
{
- this->errors.push_back(Error(errMsg));
+ this->errors.emplace_back(errMsg);
}
void cmJSONState::AddErrorAtValue(std::string const& errMsg,
@@ -65,7 +65,7 @@ void cmJSONState::AddErrorAtOffset(std::string const& errMsg,
this->AddError(errMsg);
} else {
Location loc = LocateInDocument(offset);
- this->errors.push_back(Error(loc, errMsg));
+ this->errors.emplace_back(loc, errMsg);
}
}
@@ -118,7 +118,7 @@ const Json::Value* cmJSONState::value_after(std::string const& k)
void cmJSONState::push_stack(std::string const& k, const Json::Value* value)
{
- this->parseStack.push_back(JsonPair(k, value));
+ this->parseStack.emplace_back(k, value);
}
void cmJSONState::pop_stack()