From: Richard Kreckel Date: Mon, 23 Nov 2015 18:36:53 +0000 (+0100) Subject: Convert some more ctors from copying to moving STL containers. X-Git-Tag: release_1-7-0~7^2~55 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=24064b43ff0aebda40b1b4605fa6abc2920b4518 Convert some more ctors from copying to moving STL containers. --- diff --git a/ginac/normal.cpp b/ginac/normal.cpp index c6dc39e6..e30afda6 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -1210,7 +1210,7 @@ ex add::smod(const numeric &xi) const } GINAC_ASSERT(is_exactly_a(overall_coeff)); numeric coeff = GiNaC::smod(ex_to(overall_coeff), xi); - return (new add(newseq,coeff))->setflag(status_flags::dynallocated); + return (new add(std::move(newseq), coeff))->setflag(status_flags::dynallocated); } ex mul::smod(const numeric &xi) const diff --git a/ginac/power.cpp b/ginac/power.cpp index b12ff8a4..bf48e93e 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -775,7 +775,7 @@ ex power::derivative(const symbol & s) const newseq.reserve(2); newseq.push_back(expair(basis, exponent - _ex1)); newseq.push_back(expair(basis.diff(s), _ex1)); - return mul(newseq, exponent); + return mul(std::move(newseq), exponent); } else { // D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b) return mul(*this, @@ -849,9 +849,9 @@ ex power::expand(unsigned options) const // In either case we set a flag to avoid the second run on a part // which does not have positive/negative terms. if (prodseq.size() > 0) { - ex newbasis = coeff*mul(powseq); + ex newbasis = coeff*mul(std::move(powseq)); ex_to(newbasis).setflag(status_flags::purely_indefinite); - return ((new mul(prodseq))->setflag(status_flags::dynallocated)*(new power(newbasis, exponent))->setflag(status_flags::dynallocated).expand(options)).expand(options); + return ((new mul(std::move(prodseq)))->setflag(status_flags::dynallocated)*(new power(newbasis, exponent))->setflag(status_flags::dynallocated).expand(options)).expand(options); } else ex_to(basis).setflag(status_flags::purely_indefinite); } @@ -1237,11 +1237,11 @@ ex power::expand_add(const add & a, int n, unsigned options) const GINAC_ASSERT(result.size() == result_size); if (a.overall_coeff.is_zero()) { - return (new add(result))->setflag(status_flags::dynallocated | - status_flags::expanded); + return (new add(std::move(result)))->setflag(status_flags::dynallocated | + status_flags::expanded); } else { - return (new add(result, ex_to(a.overall_coeff).power(n)))->setflag(status_flags::dynallocated | - status_flags::expanded); + return (new add(std::move(result), ex_to(a.overall_coeff).power(n)))->setflag(status_flags::dynallocated | + status_flags::expanded); } } @@ -1309,7 +1309,7 @@ ex power::expand_add_2(const add & a, unsigned options) const GINAC_ASSERT(sum.size()==(a_nops*(a_nops+1))/2); - return (new add(sum))->setflag(status_flags::dynallocated | status_flags::expanded); + return (new add(std::move(sum)))->setflag(status_flags::dynallocated | status_flags::expanded); } /** Expand factors of m in m^n where m is a mul and n is an integer. diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 01b26914..12b57d6b 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -1219,7 +1219,7 @@ ex integral::series(const relational & r, int order, unsigned options) const } // Expanding lower boundary - ex result = (new pseries(r, fexpansion))->setflag(status_flags::dynallocated); + ex result = (new pseries(r, std::move(fexpansion)))->setflag(status_flags::dynallocated); ex aseries = (a-a.subs(r)).series(r, order, options); fseries = f.series(x == (a.subs(r)), order, options); for (size_t i=0; i