mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 09:00:37 +08:00
Default Initialize ExpressionRef to Zero
The default constructor of ExpressionRef now creates a compile time constant zero assignment. This patch is required, because a reason change in Jet assumes default 0 initialization. Change-Id: I8185cef587c17ab828896bce1e768170f8229d4e
This commit is contained in:
@@ -46,7 +46,7 @@ namespace internal {
|
||||
//
|
||||
// ExpressionRef should be passed by value.
|
||||
struct ExpressionRef {
|
||||
ExpressionRef() = default;
|
||||
ExpressionRef() : ExpressionRef(0.0) {}
|
||||
|
||||
// Create a compile time constant expression directly from a double value.
|
||||
// This is important so that we can write T(3.14) in our code and
|
||||
@@ -57,6 +57,10 @@ struct ExpressionRef {
|
||||
// must work for T = Jet<ExpressionRef>.
|
||||
ExpressionRef(double compile_time_constant);
|
||||
|
||||
// Adds the expression to the active graph and initializes this ExpressionRef
|
||||
// accordingly.
|
||||
ExpressionRef(const Expression& expression);
|
||||
|
||||
// By adding this deleted constructor we can detect invalid usage of
|
||||
// ExpressionRef. ExpressionRef must only be created from constexpr doubles.
|
||||
//
|
||||
@@ -97,8 +101,6 @@ struct ExpressionRef {
|
||||
|
||||
// The index into the ExpressionGraph data array.
|
||||
ExpressionId id = kInvalidExpressionId;
|
||||
|
||||
static ExpressionRef Create(ExpressionId id);
|
||||
};
|
||||
|
||||
// A helper function which calls 'InsertBack' on the currently active graph.
|
||||
|
||||
Reference in New Issue
Block a user