From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 16 Jun 2024 12:08:49 -0700 Subject: [PATCH 02/10] Use wpi::SmallVector --- include/sleipnir/autodiff/expression.hpp | 4 ++-- include/sleipnir/autodiff/variable.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sleipnir/autodiff/expression.hpp b/include/sleipnir/autodiff/expression.hpp index af10b505ae44ca0eb656f66f3f49172d7fc98c6d..7a9dc089a9e2fb323ecc8725f924ebee1b213af0 100644 --- a/include/sleipnir/autodiff/expression.hpp +++ b/include/sleipnir/autodiff/expression.hpp @@ -34,7 +34,7 @@ struct Expression; template constexpr void inc_ref_count(Expression* expr); template -constexpr void dec_ref_count(Expression* expr); +void dec_ref_count(Expression* expr); /// Typedef for intrusive shared pointer to Expression. /// @@ -744,7 +744,7 @@ constexpr void inc_ref_count(Expression* expr) { /// @tparam Scalar Scalar type. /// @param expr The shared pointer's managed object. template -constexpr void dec_ref_count(Expression* expr) { +void dec_ref_count(Expression* expr) { // If a deeply nested tree is being deallocated all at once, calling the // Expression destructor when expr's refcount reaches zero can cause a stack // overflow. Instead, we iterate over its children to decrement their diff --git a/include/sleipnir/autodiff/variable.hpp b/include/sleipnir/autodiff/variable.hpp index 910ebcf5266bdf76711db7849dd6584549094e3b..3c4f67c1f6224226620e2ffcc597336435943ce8 100644 --- a/include/sleipnir/autodiff/variable.hpp +++ b/include/sleipnir/autodiff/variable.hpp @@ -53,7 +53,7 @@ class Variable : public SleipnirBase { Variable() = default; /// Constructs an empty Variable. - explicit constexpr Variable(std::nullptr_t) : expr{nullptr} {} + explicit Variable(std::nullptr_t) : expr{nullptr} {} /// Constructs a Variable from a scalar type. /// @@ -96,7 +96,7 @@ class Variable : public SleipnirBase { /// Constructs a Variable pointing to the specified expression. /// /// @param expr The autodiff variable. - explicit constexpr Variable(detail::ExpressionPtr&& expr) + explicit Variable(detail::ExpressionPtr&& expr) : expr{std::move(expr)} {} /// Assignment operator for scalar.