mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 09:00:37 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user