}
// Separator is "+", except if the following expression would have a leading minus sign
- it++;
+ ++it;
if (it != itend && !(it->coeff.compare(_num0()) < 0 || (it->coeff.compare(_num1()) == 0 && is_exactly_a<numeric>(it->rest) && it->rest.compare(_num0()) < 0)))
c.s << "+";
}
c.s << '*';
}
it->rest.print(c, precedence());
- it++;
+ ++it;
}
if (precedence() <= level) {
ex add::expand(unsigned options) const
{
- if (flags & status_flags::expanded)
- return *this;
-
epvector *vp = expandchildren(options);
if (vp == NULL) {
// the terms have not changed, so it is safe to declare this expanded
- return this->setflag(status_flags::expanded);
+ return (options == 0) ? setflag(status_flags::expanded) : *this;
}
- return (new add(vp, overall_coeff))->setflag(status_flags::expanded | status_flags::dynallocated);
+ return (new add(vp, overall_coeff))->setflag(status_flags::dynallocated | (options == 0 ? status_flags::expanded : 0));
}
} // namespace GiNaC