Hello, On Sun, Aug 15, 2010 at 11:10:02AM +0200, Kraus Philipp wrote:
I'm using GiNaC 1.5.8 and have declared a GiNaC::symtab with symbols. How can I remove a symbole (by string name or GiNaC::symbol expression) from the table?
GiNaC::symtab is an associative array (std::map) which maps input strings to variables in the (C++) code (this fact is somewhat documented in the tutorial, see the paragraph 5.15.2, titled as `Expression input'). Therefore one can manipulate symtabs in a usual STL'ish manner: symbol x("x"), y("y"); symtab test; test["x"] = x; test.insert(make_pair("y", y)); test["Funny"] = x + y; // remove the entry containing the expression x + y symtab::iterator i = test.begin(); while (i != test.end()) { // be careful to not invalidate the iterator, use post-increment if (i->second->is_equal(x + y)) test.erase(i++); else ++i; } test.erase("x"); Best regards, Alexei