diff --git a/gtsam/nonlinear/Expression.h b/gtsam/nonlinear/Expression.h index 3c9c4eeee..a39b1557c 100644 --- a/gtsam/nonlinear/Expression.h +++ b/gtsam/nonlinear/Expression.h @@ -170,6 +170,15 @@ public: return root_->value(values); } + /** + * @return a "deep" copy of this Expression + * "deep" is in quotes because the ExpressionNode hierarchy is *not* cloned. + * The intent is for derived classes to be copied using only a Base pointer. + */ + virtual boost::shared_ptr clone() const { + return boost::make_shared(*this); + } + private: /// Vaguely unsafe keys and dimensions in same order