Remove ExpressionRef Move Constructor

The move constructor and move =operator are not required. They make
the code more complex and prone to bugs. The few saved assignments
are all trivial and are optimized away by the compiler or our
optimizer.

In fact, there is a bug in the current move-constructor implementation
that occurs, for example, when moving Eigen matrices around.

Change-Id: I013796495bb39f3f27677111bd0aaf49e2454e20
This commit is contained in:
Darius Rueckert
2020-01-14 16:55:21 +01:00
parent f26f954105
commit 8def196166
3 changed files with 2 additions and 64 deletions
+1 -12
View File
@@ -34,6 +34,7 @@
#define CERES_CODEGEN
#include "ceres/codegen/internal/expression_ref.h"
#include "ceres/codegen/internal/expression_graph.h"
#include "gtest/gtest.h"
@@ -112,18 +113,6 @@ TEST(ExpressionRef, AssignmentCreate) {
EXPECT_EQ(reference, graph);
}
TEST(ExpressionRef, MoveAssignmentCreate) {
StartRecordingExpressions();
T a = 2;
T b = std::move(a);
auto graph = StopRecordingExpressions();
EXPECT_EQ(graph.Size(), 1);
ExpressionGraph reference;
reference.InsertBack(Expression::CreateCompileTimeConstant(2));
EXPECT_EQ(reference, graph);
}
TEST(ExpressionRef, MoveAssignment) {
StartRecordingExpressions();
T a = 1;