diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-07-28 19:30:56 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-07-28 19:30:56 (GMT) |
commit | bd0d03386b0f02aa34da5438d8f78575cf2642e7 (patch) | |
tree | 31cf890670f8121a5668a2b65516ba3ec220f660 /Source/cmComputeComponentGraph.cxx | |
parent | 7788494257e0a1a22468b5542f9d8c5cb8c3dfed (diff) | |
download | CMake-bd0d03386b0f02aa34da5438d8f78575cf2642e7.zip CMake-bd0d03386b0f02aa34da5438d8f78575cf2642e7.tar.gz CMake-bd0d03386b0f02aa34da5438d8f78575cf2642e7.tar.bz2 |
cmComputeComponentGraph: Move work out of constructor into Compute() method
The computation of Tarjan's algorithm is an expensive operation which
should not be done in the constructor. Move this work into a dedicated
Compute() method, and call this method explicitly.
Diffstat (limited to 'Source/cmComputeComponentGraph.cxx')
-rw-r--r-- | Source/cmComputeComponentGraph.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index 81cd878..6591fb1 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -8,6 +8,12 @@ cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input) : InputGraph(input) { +} + +cmComputeComponentGraph::~cmComputeComponentGraph() = default; + +void cmComputeComponentGraph::Compute() +{ // Identify components. this->Tarjan(); @@ -17,8 +23,6 @@ cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input) this->TransferEdges(); } -cmComputeComponentGraph::~cmComputeComponentGraph() = default; - void cmComputeComponentGraph::Tarjan() { int n = static_cast<int>(this->InputGraph.size()); |