From: Richard Kreckel Date: Thu, 17 Dec 2015 08:32:15 +0000 (+0100) Subject: Add rvalue reference ctors from epvectors for add, mul. X-Git-Tag: release_1-7-0~7^2~34 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=6eb7dee7ea9e83d3e0599aec9ab7c6084a47b71c Add rvalue reference ctors from epvectors for add, mul. --- diff --git a/ginac/add.cpp b/ginac/add.cpp index 2a2e2f83..79994e11 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -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; @@ -492,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(std::move(s), _ex0); + return dynallocate(std::move(s)); } int add::compare_same_type(const basic & other) const diff --git a/ginac/add.h b/ginac/add.h index 42761576..aebb7c0e 100644 --- a/ginac/add.h +++ b/ginac/add.h @@ -41,7 +41,8 @@ public: add(const exvector & v); add(const epvector & v); add(const epvector & v, const ex & oc); - add(epvector && vp, const ex & oc); + add(epvector && v); + add(epvector && v, const ex & oc); // functions overriding virtual functions from base classes public: diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 36960c0a..3f2d5cdb 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -89,6 +89,13 @@ mul::mul(const epvector & v, const ex & oc, bool do_index_renaming) GINAC_ASSERT(is_canonical()); } +mul::mul(epvector && vp) +{ + overall_coeff = _ex1; + construct_from_epvector(std::move(vp)); + GINAC_ASSERT(is_canonical()); +} + mul::mul(epvector && vp, const ex & oc, bool do_index_renaming) { overall_coeff = oc; diff --git a/ginac/mul.h b/ginac/mul.h index e689ddf1..d8df6548 100644 --- a/ginac/mul.h +++ b/ginac/mul.h @@ -42,6 +42,7 @@ public: mul(const exvector & v); mul(const epvector & v); mul(const epvector & v, const ex & oc, bool do_index_renaming = false); + mul(epvector && vp); mul(epvector && vp, const ex & oc, bool do_index_renaming = false); mul(const ex & lh, const ex & mh, const ex & rh);