mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 06:40:16 -05:00
Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user