diff --git a/include/cenet/math/expr.hpp b/include/cenet/math/expr.hpp index 00c6384..b1a2798 100644 --- a/include/cenet/math/expr.hpp +++ b/include/cenet/math/expr.hpp @@ -14,7 +14,12 @@ struct expression_tag {}; template struct unary_expression : expression_tag { - E expr; + E expr; + Op op; + + template >> + unary_expression(EFwd&& expr, OpFwd&& op = Op{}) // NOLINT + : expr(std::forward(expr)), op(std::forward(op)) {} constexpr auto shape() const { return expr.shape(); } @@ -23,12 +28,13 @@ struct unary_expression : expression_tag { template struct binary_expression : expression_tag { - L lhs; - R rhs; + L lhs; + R rhs; + Op op; - template - binary_expression(LFwd&& lhs, RFwd&& rhs) - : lhs(std::forward(lhs)), rhs(std::forward(rhs)) {} + template + binary_expression(LFwd&& lhs, RFwd&& rhs, OpFwd&& op = Op{}) + : lhs(std::forward(lhs)), rhs(std::forward(rhs)), op(std::forward(op)) {} constexpr auto shape() const { return Op::shape(lhs, rhs); }