From 08e2a90e2d6026701d1368fd0fa6f29d84fa10bf Mon Sep 17 00:00:00 2001 From: Alvin Zhang <41vin2h4n9@gmail.com> Date: Sun, 1 Dec 2024 10:11:13 -0800 Subject: [PATCH] feat: also ban moving expressions --- include/suboptimal/autodiff/Expression.h | 4 ++-- include/suboptimal/autodiff/Variable.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/suboptimal/autodiff/Expression.h b/include/suboptimal/autodiff/Expression.h index a3bc557..5de162d 100644 --- a/include/suboptimal/autodiff/Expression.h +++ b/include/suboptimal/autodiff/Expression.h @@ -63,11 +63,11 @@ struct Expression { Expression(const Expression& other) = delete; - Expression(Expression&& other) = default; + Expression(Expression&& other) = delete; Expression& operator=(const Expression& other) = delete; - Expression& operator=(Expression&& other) = default; + Expression& operator=(Expression&& other) = delete; ~Expression() = default; diff --git a/include/suboptimal/autodiff/Variable.h b/include/suboptimal/autodiff/Variable.h index 9abc09c..9c1f295 100644 --- a/include/suboptimal/autodiff/Variable.h +++ b/include/suboptimal/autodiff/Variable.h @@ -31,7 +31,8 @@ using Matrix3v = Eigen::Matrix3; using Matrix4v = Eigen::Matrix4; /** - * An autodiff variable. Essentially just a nicer wrapper around Expression + * An autodiff variable. Basically a nicer wrapper around Expression. Unlike Expression, a Variable is safe to copy and + * move around. */ struct Variable { ExpressionPtr expr = std::make_shared(0.0, Linearity::Linear);