diff options
author | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-25 13:59:33 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-26 10:24:45 (GMT) |
commit | c85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch) | |
tree | 97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/cmDocumentationSection.cxx | |
parent | fa3ac83af0edf958d26b246109db6e3d6d128d70 (diff) | |
download | CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.zip CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.gz CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.bz2 |
Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
Diffstat (limited to 'Source/cmDocumentationSection.cxx')
-rw-r--r-- | Source/cmDocumentationSection.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmDocumentationSection.cxx b/Source/cmDocumentationSection.cxx index c47f33e..439da1b 100644 --- a/Source/cmDocumentationSection.cxx +++ b/Source/cmDocumentationSection.cxx @@ -6,7 +6,7 @@ void cmDocumentationSection::Append(const char* data[][2]) { int i = 0; while (data[i][1]) { - this->Entries.push_back(cmDocumentationEntry(data[i][0], data[i][1])); + this->Entries.emplace_back(data[i][0], data[i][1]); data += 1; } } @@ -16,7 +16,7 @@ void cmDocumentationSection::Prepend(const char* data[][2]) std::vector<cmDocumentationEntry> tmp; int i = 0; while (data[i][1]) { - tmp.push_back(cmDocumentationEntry(data[i][0], data[i][1])); + tmp.emplace_back(data[i][0], data[i][1]); data += 1; } this->Entries.insert(this->Entries.begin(), tmp.begin(), tmp.end()); @@ -24,5 +24,5 @@ void cmDocumentationSection::Prepend(const char* data[][2]) void cmDocumentationSection::Append(const char* n, const char* b) { - this->Entries.push_back(cmDocumentationEntry(n, b)); + this->Entries.emplace_back(n, b); } |