summaryrefslogtreecommitdiff
path: root/Source/cmComputeComponentGraph.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <pa.solodovnikov@tensor.ru>2018-01-25 16:59:33 +0300
committerPavel Solodovnikov <pa.solodovnikov@tensor.ru>2018-01-26 13:24:45 +0300
commitc85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch)
tree97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/cmComputeComponentGraph.cxx
parentfa3ac83af0edf958d26b246109db6e3d6d128d70 (diff)
downloadcmake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.gz
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/cmComputeComponentGraph.cxx')
-rw-r--r--Source/cmComputeComponentGraph.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx
index 9ec98ae8e8..a7dc1ca03a 100644
--- a/Source/cmComputeComponentGraph.cxx
+++ b/Source/cmComputeComponentGraph.cxx
@@ -88,7 +88,7 @@ void cmComputeComponentGraph::TarjanVisit(int i)
if (this->TarjanEntries[i].Root == i) {
// Yes. Create it.
int c = static_cast<int>(this->Components.size());
- this->Components.push_back(NodeList());
+ this->Components.emplace_back();
NodeList& component = this->Components[c];
// Populate the component list.
@@ -125,8 +125,8 @@ void cmComputeComponentGraph::TransferEdges()
if (i_component != j_component) {
// We do not attempt to combine duplicate edges, but instead
// store the inter-component edges with suitable multiplicity.
- this->ComponentGraph[i_component].push_back(
- cmGraphEdge(j_component, ni.IsStrong()));
+ this->ComponentGraph[i_component].emplace_back(j_component,
+ ni.IsStrong());
}
}
}