From 6eb7dee7ea9e83d3e0599aec9ab7c6084a47b71c Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Thu, 17 Dec 2015 09:32:15 +0100 Subject: [PATCH] Add rvalue reference ctors from epvectors for add, mul. --- ginac/add.cpp | 9 ++++++++- ginac/add.h | 3 ++- ginac/mul.cpp | 7 +++++++ ginac/mul.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) 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); -- 2.44.0