GradientProblem & related classes use std::unique_ptr

Previously these classes in analogy with ceres::Problem's interface
had interfaces to allow bare pointers as well as unique_ptrs. This
CL changes the API to always use unique_ptr, this is less error prone
and makes the default ownership semantics clearer.

Change-Id: I7577a90761f341c7e009c248c820f0fec2e6f32d
This commit is contained in:
Sameer Agarwal
2024-08-14 11:15:23 -07:00
parent 487ce37fa7
commit 8f1b6123ad
14 changed files with 83 additions and 101 deletions
+5 -5
View File
@@ -47,12 +47,12 @@ struct Rosenbrock {
return true;
}
static ceres::FirstOrderFunction* Create() {
static std::unique_ptr<ceres::FirstOrderFunction> Create() {
constexpr int kNumParameters = 2;
return new ceres::NumericDiffFirstOrderFunction<Rosenbrock,
ceres::CENTRAL,
kNumParameters>(
new Rosenbrock);
return std::make_unique<
ceres::NumericDiffFirstOrderFunction<Rosenbrock,
ceres::CENTRAL,
kNumParameters>>();
}
};