// copy rest
while (cit2 != end) {
- s->push_back(cit2->subs(ls, lr, options));
+ try {
+ s->push_back(cit2->subs(ls, lr, options));
+ } catch (...) {
+ delete s;
+ throw;
+ }
++cit2;
}
return s;
s->push_back(*cit2);
++cit2;
}
+
// copy first changed element
s->push_back(combine_ex_with_coeff_to_pair(evaled_ex,
cit2->coeff));
// Copy rest
while (cit != last) {
- s->push_back(split_ex_to_pair(recombine_pair_to_ex(*cit).subs(ls, lr, options)));
+ try {
+ s->push_back(split_ex_to_pair(recombine_pair_to_ex(*cit).subs(ls, lr, options)));
+ } catch (...) {
+ delete s;
+ throw;
+ }
++cit;
}
return s;
// Copy rest
while (cit != last) {
- s->push_back(combine_ex_with_coeff_to_pair(cit->rest.subs(ls, lr, options),
- cit->coeff));
+ try {
+ s->push_back(combine_ex_with_coeff_to_pair(cit->rest.subs(ls, lr, options),
+ cit->coeff));
+ } catch (...) {
+ delete s;
+ throw;
+ }
++cit;
}
return s;