
I did not find in the documentation a way to erase all the elements of an lst. More formally, what is needed is the functionality provided by, e.g.,
void clear(GiNaC::lst& l) { for (unsigned n = l.nops(); n-- > 0; ) l.remove_first(); assert(l.nops() == 0); }
Something like that turns out to be very useful in several situations. For an example, consider the following:
if (match(e, pattern_1, substitution)) ... else if (clear(substitution), match(e, pattern_2, substitution)) ... else if (clear(substitution), match(e, pattern_3, substitution)) ...
Please, consider the addition of such a method to GiNaC::lst. You may not want to call it clear() though, as this is perhaps too STL-ish (someone may be induced to think that lst is an STL container and we do not want that ;-) All the best
Roberto