[modernize] Use if constexpr in EuclideanManifold constructor

Change-Id: I61d4827d7b04feed369c72db3643afda67ea434e
This commit is contained in:
Sameer Agarwal
2026-03-16 17:32:41 -07:00
parent 4bd55bd44c
commit 4390b34d5b
+2 -8
View File
@@ -245,14 +245,8 @@ class EuclideanManifold final : public Manifold {
static_assert(ceres::DYNAMIC == Eigen::Dynamic,
"ceres::DYNAMIC needs to be the same as Eigen::Dynamic.");
EuclideanManifold() : size_{Size} {
static_assert(
Size != ceres::DYNAMIC,
"The size is set to dynamic. Please call the constructor with a size.");
}
explicit EuclideanManifold(int size) : size_(size) {
if (Size != ceres::DYNAMIC) {
explicit EuclideanManifold(int size = Size) : size_(size) {
if constexpr (Size != ceres::DYNAMIC) {
CHECK_EQ(Size, size)
<< "Specified size by template parameter differs from the supplied "
"one.";