Convert factory functions to return std::unique_ptrs.

https://github.com/ceres-solver/ceres-solver/issues/755

Change-Id: I8ff028ca6082a5f448f3891214af03971d565937
This commit is contained in:
Sameer Agarwal
2022-02-10 16:16:37 -08:00
parent 708a2a7233
commit 44039af2cb
26 changed files with 101 additions and 95 deletions
+2 -2
View File
@@ -257,11 +257,11 @@ Vertex FindConnectedComponent(const Vertex& vertex,
// spanning forest, or a collection of linear paths that span the
// graph G.
template <typename Vertex>
WeightedGraph<Vertex>* Degree2MaximumSpanningForest(
std::unique_ptr<WeightedGraph<Vertex>> Degree2MaximumSpanningForest(
const WeightedGraph<Vertex>& graph) {
// Array of edges sorted in decreasing order of their weights.
std::vector<std::pair<double, std::pair<Vertex, Vertex>>> weighted_edges;
WeightedGraph<Vertex>* forest = new WeightedGraph<Vertex>();
auto forest = std::make_unique<WeightedGraph<Vertex>>();
// Disjoint-set to keep track of the connected components in the
// maximum spanning tree.