Files
allwpilib/upstream_utils/sleipnir_patches/0002-Use-wpi-SmallVector.patch

55 lines
2.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <calcmogul@gmail.com>
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 f04967c6a84ea76b77cebb7ef8edcb798d03e2a5..361c74702107eadf6f1fbe1682a7ef296abd19a3 100644
--- a/include/sleipnir/autodiff/expression.hpp
+++ b/include/sleipnir/autodiff/expression.hpp
@@ -34,7 +34,7 @@ struct Expression;
template <typename Scalar>
constexpr void inc_ref_count(Expression<Scalar>* expr);
template <typename Scalar>
-constexpr void dec_ref_count(Expression<Scalar>* expr);
+void dec_ref_count(Expression<Scalar>* expr);
/// Typedef for intrusive shared pointer to Expression.
///
@@ -749,7 +749,7 @@ constexpr void inc_ref_count(Expression<Scalar>* expr) {
/// @tparam Scalar Scalar type.
/// @param expr The shared pointer's managed object.
template <typename Scalar>
-constexpr void dec_ref_count(Expression<Scalar>* expr) {
+void dec_ref_count(Expression<Scalar>* 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 a6b054494a18eacbcae10c0e88648550a39ed48e..ad8baa3b58047f5257c210b88446324cca121d4a 100644
--- a/include/sleipnir/autodiff/variable.hpp
+++ b/include/sleipnir/autodiff/variable.hpp
@@ -58,7 +58,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.
///
@@ -101,7 +101,7 @@ class Variable : public SleipnirBase {
/// Constructs a Variable pointing to the specified expression.
///
/// @param expr The autodiff variable.
- explicit constexpr Variable(detail::ExpressionPtr<Scalar>&& expr)
+ explicit Variable(detail::ExpressionPtr<Scalar>&& expr)
: expr{std::move(expr)} {}
/// Assignment operator for scalar.