X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fpolynomial%2Fcollect_vargs.cpp;h=6beda76fc574a0c8f375dce15efc1bb620f80940;hp=b7fb8a9cbb572d9f82d3ae2c22a0d6ebd20efead;hb=8cffcdf13d817a47f217f1a1043317d95969e070;hpb=286b0d93528e35957a50c51343e0b4a9bc623bce diff --git a/ginac/polynomial/collect_vargs.cpp b/ginac/polynomial/collect_vargs.cpp index b7fb8a9c..6beda76f 100644 --- a/ginac/polynomial/collect_vargs.cpp +++ b/ginac/polynomial/collect_vargs.cpp @@ -3,7 +3,7 @@ * Utility functions. */ /* - * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2019 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +118,7 @@ collect_term(ex_collect_priv_t& ec, const ex& e, const exvector& vars) key[i] = var_i_pow; pre_coeff = pre_coeff.coeff(vars[i], var_i_pow); } - ex_collect_priv_t::iterator i = ec.find(key); + auto i = ec.find(key); if (i != ec.end()) i->second += pre_coeff; else @@ -127,9 +127,9 @@ collect_term(ex_collect_priv_t& ec, const ex& e, const exvector& vars) static void wipe_out_zeros(ex_collect_priv_t& m) { - ex_collect_priv_t::iterator i = m.begin(); + auto i = m.begin(); while (i != m.end()) { - // be careful to not invalide iterator, use post-increment + // be careful to not invalidate the iterator, use post-increment // for that, see e.g. // http://coding.derkeiler.com/Archive/C_CPP/comp.lang.cpp/2004-02/0502.html if (i->second.is_zero()) @@ -139,8 +139,8 @@ static void wipe_out_zeros(ex_collect_priv_t& m) } } -GiNaC::ex -ex_collect_to_ex(const ex_collect_t& ec, const GiNaC::exvector& vars) +ex +ex_collect_to_ex(const ex_collect_t& ec, const exvector& vars) { exvector ev; ev.reserve(ec.size()); @@ -155,13 +155,13 @@ ex_collect_to_ex(const ex_collect_t& ec, const GiNaC::exvector& vars) "expression has " << exp_vector.size() << " instead"); if (exp_vector[j] != 0) - tv.push_back(power(vars[j], exp_vector[j])); + tv.push_back(pow(vars[j], exp_vector[j])); } tv.push_back(ec[i].second); - ex tmp = (new mul(tv))->setflag(status_flags::dynallocated); + ex tmp = dynallocate(tv); ev.push_back(tmp); } - ex ret = (new add(ev))->setflag(status_flags::dynallocated); + ex ret = dynallocate(ev); return ret; }