]> www.ginac.de Git - ginac.git/blobdiff - ginac/add.cpp
Add rvalue reference ctors from epvectors for add, mul.
[ginac.git] / ginac / add.cpp
index ed58730941a3c9d062475ef175b44c023010187d..79994e11c5ddf47e54b84daf883b014b1f1410a4 100644 (file)
@@ -86,6 +86,13 @@ add::add(const epvector & v, const ex & oc)
        GINAC_ASSERT(is_canonical());
 }
 
+add::add(epvector && vp)
+{
+       overall_coeff = _ex0;
+       construct_from_epvector(std::move(vp));
+       GINAC_ASSERT(is_canonical());
+}
+
 add::add(epvector && vp, const ex & oc)
 {
        overall_coeff = oc;
@@ -326,17 +333,16 @@ ex add::coeff(const ex & s, int n) const
  *  an expression that contain a plain number.
  *  - +(;c) -> c
  *  - +(x;0) -> x
- *
- *  @param level cut-off in recursive evaluation */
-ex add::eval(int level) const
+ */
+ex add::eval() const
 {
-       if ((level == 1) && (flags & status_flags::evaluated)) {
+       if (flags & status_flags::evaluated) {
                GINAC_ASSERT(seq.size()>0);
                GINAC_ASSERT(seq.size()>1 || !overall_coeff.is_zero());
                return *this;
        }
 
-       const epvector evaled = evalchildren(level);
+       const epvector evaled = evalchildren();
        if (unlikely(!evaled.empty())) {
                // start over evaluating a new object
                return dynallocate<add>(std::move(evaled), overall_coeff);
@@ -493,7 +499,7 @@ ex add::derivative(const symbol & y) const
        for (auto & it : seq)
                s.push_back(expair(it.rest.diff(y), it.coeff));
 
-       return dynallocate<add>(std::move(s), _ex0);
+       return dynallocate<add>(std::move(s));
 }
 
 int add::compare_same_type(const basic & other) const