mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 09:00:37 +08:00
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:
@@ -45,9 +45,10 @@ in Ceres.
|
||||
return true;
|
||||
}
|
||||
|
||||
static ceres::FirstOrderFunction* Create() {
|
||||
static std::unique_ptr<ceres::FirstOrderFunction> Create() {
|
||||
constexpr int kNumParameters = 2;
|
||||
return new ceres::AutoDiffFirstOrderFunction<Rosenbrock, kNumParameters>();
|
||||
return std::make_unique<
|
||||
ceres::AutoDiffFirstOrderFunction<Rosenbrock, kNumParameters>>();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -156,11 +157,12 @@ follows [#f2]_.
|
||||
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>();
|
||||
return std::make_unique<
|
||||
ceres::NumericDiffFirstOrderFunction<Rosenbrock,
|
||||
ceres::CENTRAL,
|
||||
kNumParameters>>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user