Feature request: clearing lsts
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@cs.unipr.it
Hi! On Fri, Jan 18, 2002 at 10:41:28PM +0100, Roberto Bagnara wrote:
I did not find in the documentation a way to erase all the elements of an lst.
l = lst(); ? Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
Roberto Bagnara