Fix use of incomplete type in defaulted Problem methods
- As Problem contains a unique_ptr<ProblemImpl> and as defaulted
methods are declared inline where ProblemImpl's implementation is not
available use of '= default' will generate compile errors on strict
compilers.
- This CL moves the definition of defaulted methods to the
implementation.
Change-Id: I7d79757cf684378fadef8e6f4000c84387018cdb
diff --git a/include/ceres/problem.h b/include/ceres/problem.h
index ba9b903..e43616e 100644
--- a/include/ceres/problem.h
+++ b/include/ceres/problem.h
@@ -189,8 +189,8 @@
// invocation Problem(Problem::Options()).
Problem();
explicit Problem(const Options& options);
- Problem(Problem&&) = default;
- Problem& operator=(Problem&&) = default;
+ Problem(Problem&&);
+ Problem& operator=(Problem&&);
Problem(const Problem&) = delete;
Problem& operator=(const Problem&) = delete;
diff --git a/internal/ceres/problem.cc b/internal/ceres/problem.cc
index f4efa6e..767fe97 100644
--- a/internal/ceres/problem.cc
+++ b/internal/ceres/problem.cc
@@ -43,6 +43,9 @@
Problem::Problem() : impl_(new internal::ProblemImpl) {}
Problem::Problem(const Problem::Options& options)
: impl_(new internal::ProblemImpl(options)) {}
+// Not inline defaulted in declaration due to use of std::unique_ptr.
+Problem::Problem(Problem&&) = default;
+Problem& Problem::operator=(Problem&&) = default;
Problem::~Problem() {}
ResidualBlockId Problem::AddResidualBlock(