// Add root node ID to list of archived expressions
archived_ex ae = archived_ex(atomize(name), id);
- exprs.push_back(ae);
+ exprs.emplace_back(ae);
}
void archive_node::add_bool(const std::string &name, bool value)
{
- props.push_back(property(a.atomize(name), PTYPE_BOOL, value));
+ props.emplace_back(property(a.atomize(name), PTYPE_BOOL, value));
}
void archive_node::add_unsigned(const std::string &name, unsigned value)
{
- props.push_back(property(a.atomize(name), PTYPE_UNSIGNED, value));
+ props.emplace_back(property(a.atomize(name), PTYPE_UNSIGNED, value));
}
void archive_node::add_string(const std::string &name, const std::string &value)
{
- props.push_back(property(a.atomize(name), PTYPE_STRING, a.atomize(value)));
+ props.emplace_back(property(a.atomize(name), PTYPE_STRING, a.atomize(value)));
}
void archive_node::add_ex(const std::string &name, const ex &value)
{
// Recursively create an archive_node and add its ID to the properties of this node
archive_node_id id = a.add_node(archive_node(a, value));
- props.push_back(property(a.atomize(name), PTYPE_NODE, id));
+ props.emplace_back(property(a.atomize(name), PTYPE_NODE, id));
}
++a;
}
if (!found)
- v.push_back(property_info(type, name));
+ v.emplace_back(property_info(type, name));
i++;
}
}
// optimize away
} else if (exponent[i] == 1) {
// optimized
- monomial.push_back(expair(r, _ex1));
+ monomial.emplace_back(expair(r, _ex1));
if (c != *_num1_p)
factor = factor.mul(c);
} else { // general case exponent[i] > 1
- monomial.push_back(expair(r, exponent[i]));
+ monomial.emplace_back(expair(r, exponent[i]));
if (c != *_num1_p)
factor = factor.mul(c.power(exponent[i]));
}
}
- result.push_back(expair(mul(std::move(monomial)).expand(options), factor));
+ result.emplace_back(expair(mul(std::move(monomial)).expand(options), factor));
} while (compositions.next());
} while (partitions.next());
}
if (c.is_equal(_ex1)) {
if (is_exactly_a<mul>(r)) {
- result.push_back(expair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
- _ex1));
+ result.emplace_back(expair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
+ _ex1));
} else {
- result.push_back(expair(dynallocate<power>(r, _ex2),
- _ex1));
+ result.emplace_back(expair(dynallocate<power>(r, _ex2),
+ _ex1));
}
} else {
if (is_exactly_a<mul>(r)) {
- result.push_back(expair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
- ex_to<numeric>(c).power_dyn(*_num2_p)));
+ result.emplace_back(expair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
+ ex_to<numeric>(c).power_dyn(*_num2_p)));
} else {
- result.push_back(expair(dynallocate<power>(r, _ex2),
- ex_to<numeric>(c).power_dyn(*_num2_p)));
+ result.emplace_back(expair(dynallocate<power>(r, _ex2),
+ ex_to<numeric>(c).power_dyn(*_num2_p)));
}
}
for (auto cit1=cit0+1; cit1!=last; ++cit1) {
const ex & r1 = cit1->rest;
const ex & c1 = cit1->coeff;
- result.push_back(expair(mul(r,r1).expand(options),
- _num2_p->mul(ex_to<numeric>(c)).mul_dyn(ex_to<numeric>(c1))));
+ result.emplace_back(expair(mul(r,r1).expand(options),
+ _num2_p->mul(ex_to<numeric>(c)).mul_dyn(ex_to<numeric>(c1))));
}
}
epvector new_seq;
new_seq.reserve(seq.size());
for (auto & it : seq)
- new_seq.push_back(expair(it.rest, it.coeff));
+ new_seq.emplace_back(expair(it.rest, it.coeff));
return dynallocate<pseries>(relational(var,point), std::move(new_seq)).setflag(status_flags::evaluated);
}
epvector new_seq;
new_seq.reserve(seq.size());
for (auto & it : seq)
- new_seq.push_back(expair(it.rest, it.coeff));
+ new_seq.emplace_back(expair(it.rest, it.coeff));
return dynallocate<pseries>(relational(var,point), std::move(new_seq)).setflag(status_flags::evaluated);
}
epvector v;
v.reserve(seq.size());
for (auto & it : seq)
- v.push_back(expair((it.rest).real_part(), it.coeff));
+ v.emplace_back(expair(it.rest.real_part(), it.coeff));
return dynallocate<pseries>(var==point, std::move(v));
}
epvector v;
v.reserve(seq.size());
for (auto & it : seq)
- v.push_back(expair((it.rest).imag_part(), it.coeff));
+ v.emplace_back(expair(it.rest.imag_part(), it.coeff));
return dynallocate<pseries>(var==point, std::move(v));
}
std::unique_ptr<epvector> newseq(nullptr);
for (auto i=seq.begin(); i!=seq.end(); ++i) {
if (newseq) {
- newseq->push_back(expair(i->rest.eval_integ(), i->coeff));
+ newseq->emplace_back(expair(i->rest.eval_integ(), i->coeff));
continue;
}
ex newterm = i->rest.eval_integ();
newseq->reserve(seq.size());
for (auto j=seq.begin(); j!=i; ++j)
newseq->push_back(*j);
- newseq->push_back(expair(newterm, i->coeff));
+ newseq->emplace_back(expair(newterm, i->coeff));
}
}
if (something_changed) {
ex newcoeff = i->rest.evalm();
if (!newcoeff.is_zero())
- newseq.push_back(expair(newcoeff, i->coeff));
+ newseq.emplace_back(expair(newcoeff, i->coeff));
} else {
ex newcoeff = i->rest.evalm();
if (!are_ex_trivially_equal(newcoeff, i->rest)) {
newseq.reserve(seq.size());
std::copy(seq.begin(), i, std::back_inserter<epvector>(newseq));
if (!newcoeff.is_zero())
- newseq.push_back(expair(newcoeff, i->coeff));
+ newseq.emplace_back(expair(newcoeff, i->coeff));
}
}
}
epvector newseq;
newseq.reserve(seq.size());
for (auto & it : seq)
- newseq.push_back(expair(it.rest.subs(m, options), it.coeff));
+ newseq.emplace_back(expair(it.rest.subs(m, options), it.coeff));
return dynallocate<pseries>(relational(var,point.subs(m, options)), std::move(newseq));
}
for (auto & it : seq) {
ex restexp = it.rest.expand();
if (!restexp.is_zero())
- newseq.push_back(expair(restexp, it.coeff));
+ newseq.emplace_back(expair(restexp, it.coeff));
}
return dynallocate<pseries>(relational(var,point), std::move(newseq)).setflag(options == 0 ? status_flags::expanded : 0);
}
// FIXME: coeff might depend on var
for (auto & it : seq) {
if (is_order_function(it.rest)) {
- new_seq.push_back(expair(it.rest, it.coeff - 1));
+ new_seq.emplace_back(expair(it.rest, it.coeff - 1));
} else {
ex c = it.rest * it.coeff;
if (!c.is_zero())
- new_seq.push_back(expair(c, it.coeff - 1));
+ new_seq.emplace_back(expair(c, it.coeff - 1));
}
}
} else {
ex c = it.rest.diff(s);
if (!c.is_zero())
- new_seq.push_back(expair(c, it.coeff));
+ new_seq.emplace_back(expair(c, it.coeff));
}
}
}
// default for order-values that make no sense for Taylor expansion
if ((order <= 0) && this->has(s)) {
- seq.push_back(expair(Order(_ex1), order));
+ seq.emplace_back(expair(Order(_ex1), order));
return pseries(r, std::move(seq));
}
ex coeff = deriv.subs(r, subs_options::no_pattern);
if (!coeff.is_zero()) {
- seq.push_back(expair(coeff, _ex0));
+ seq.emplace_back(expair(coeff, _ex0));
}
int n;
coeff = deriv.subs(r, subs_options::no_pattern);
if (!coeff.is_zero())
- seq.push_back(expair(fac * coeff, n));
+ seq.emplace_back(expair(fac * coeff, n));
}
// Higher-order terms, if present
deriv = deriv.diff(s);
if (!deriv.expand().is_zero())
- seq.push_back(expair(Order(_ex1), n));
+ seq.emplace_back(expair(Order(_ex1), n));
return pseries(r, std::move(seq));
}
if (this->is_equal_same_type(ex_to<symbol>(r.lhs()))) {
if (order > 0 && !point.is_zero())
- seq.push_back(expair(point, _ex0));
+ seq.emplace_back(expair(point, _ex0));
if (order > 1)
- seq.push_back(expair(_ex1, _ex1));
+ seq.emplace_back(expair(_ex1, _ex1));
else
- seq.push_back(expair(Order(_ex1), numeric(order)));
+ seq.emplace_back(expair(Order(_ex1), numeric(order)));
} else
- seq.push_back(expair(*this, _ex0));
+ seq.emplace_back(expair(*this, _ex0));
return pseries(r, std::move(seq));
}
} else {
// Add coefficient of a and b
if (is_order_function((*a).rest) || is_order_function((*b).rest)) {
- new_seq.push_back(expair(Order(_ex1), (*a).coeff));
+ new_seq.emplace_back(expair(Order(_ex1), (*a).coeff));
break; // Order term ends the sequence
} else {
ex sum = (*a).rest + (*b).rest;
if (!(sum.is_zero()))
- new_seq.push_back(expair(sum, numeric(pow_a)));
+ new_seq.emplace_back(expair(sum, numeric(pow_a)));
++a;
++b;
}
for (auto & it : seq) {
if (!is_order_function(it.rest))
- new_seq.push_back(expair(it.rest * other, it.coeff));
+ new_seq.emplace_back(expair(it.rest * other, it.coeff));
else
new_seq.push_back(it);
}
co += ita->second * itb->second;
}
if (!co.is_zero())
- new_seq.push_back(expair(co, numeric(cdeg)));
+ new_seq.emplace_back(expair(co, numeric(cdeg)));
}
if (higher_order_c < std::numeric_limits<int>::max())
- new_seq.push_back(expair(Order(_ex1), numeric(higher_order_c)));
+ new_seq.emplace_back(expair(Order(_ex1), numeric(higher_order_c)));
return pseries(relational(var, point), std::move(new_seq));
}
bool higher_order = false;
for (int i=0; i<numcoeff; ++i) {
if (!co[i].is_zero())
- new_seq.push_back(expair(co[i], p * ldeg + i));
+ new_seq.emplace_back(expair(co[i], p * ldeg + i));
if (is_order_function(co[i])) {
higher_order = true;
break;
}
}
if (!higher_order)
- new_seq.push_back(expair(Order(_ex1), p * ldeg + numcoeff));
+ new_seq.emplace_back(expair(Order(_ex1), p * ldeg + numcoeff));
return pseries(relational(var,point), std::move(new_seq));
}
if (basis.is_equal(r.lhs() - r.rhs())) {
epvector new_seq;
if (ex_to<numeric>(exponent).to_int() < order)
- new_seq.push_back(expair(_ex1, exponent));
+ new_seq.emplace_back(expair(_ex1, exponent));
else
- new_seq.push_back(expair(Order(_ex1), exponent));
+ new_seq.emplace_back(expair(Order(_ex1), exponent));
return pseries(r, std::move(new_seq));
}
for (auto & it : seq) {
int o = ex_to<numeric>(it.coeff).to_int();
if (o >= order) {
- new_seq.push_back(expair(Order(_ex1), o));
+ new_seq.emplace_back(expair(Order(_ex1), o));
break;
}
new_seq.push_back(it);
? currcoeff
: integral(x, a.subs(r), b.subs(r), currcoeff);
if (currcoeff != 0)
- fexpansion.push_back(
+ fexpansion.emplace_back(
expair(currcoeff, ex_to<pseries>(fseries).exponop(i)));
}