Feature request: clearing lsts
Roberto Bagnara
bagnara at cs.unipr.it
Fri Jan 18 22:41:28 CET 2002
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
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it
More information about the GiNaC-list
mailing list