fix(math): fix nested expressions

This commit is contained in:
2026-10-30 14:53:49 +01:00
parent a4640c4835
commit 5360b4f9b0
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ struct unary_expression : expression_tag {
constexpr auto shape() const { return expr.shape(); }
auto eval(std::size_t index) { return Op{}(expr.coeff(index)); }
auto coeff(std::size_t index) const { return Op{}(expr.coeff(index)); }
};
template <typename L, typename R, typename Op>
@@ -32,7 +32,7 @@ struct binary_expression : expression_tag {
constexpr auto shape() const { return Op::shape(lhs, rhs); }
auto eval(std::size_t index) { return Op{}(index, lhs.coeff(index), as_operand(rhs)); }
auto coeff(std::size_t index) const { return Op{}(index, lhs.coeff(index), as_operand(rhs)); }
private:
template <typename T>
static decltype(auto) as_operand(T&& value) {
+1 -1
View File
@@ -199,7 +199,7 @@ public:
}
for (std::size_t i = 0; i < view().size(); ++i) {
m_items[i] = std::forward<E>(expr).eval(i);
m_items[i] = std::forward<E>(expr).coeff(i);
}
}