]> www.ginac.de Git - ginac.git/commitdiff
Fixed bug in ::match.
authorChris Dams <Chris.Dams@mi.infn.it>
Thu, 20 Apr 2006 20:10:52 +0000 (20:10 +0000)
committerChris Dams <Chris.Dams@mi.infn.it>
Thu, 20 Apr 2006 20:10:52 +0000 (20:10 +0000)
ginac/expairseq.cpp

index 7555bd185d422c011beb9a86f5de8e6ea5b61666..549d1f845779e173f7466387cb038aa90937d9b6 100644 (file)
@@ -382,10 +382,20 @@ bool expairseq::match(const ex & pattern, lst & repl_lst) const
                                continue;
                        exvector::iterator it = ops.begin(), itend = ops.end();
                        while (it != itend) {
+                               lst::const_iterator last_el = repl_lst.end();
+                               --last_el;
                                if (it->match(p, repl_lst)) {
                                        ops.erase(it);
                                        goto found;
                                }
+                               while(true) {
+                                       lst::const_iterator next_el = last_el;
+                                       ++next_el;
+                                       if(next_el == repl_lst.end())
+                                               break;
+                                       else
+                                               repl_lst.remove_last();
+                               }
                                ++it;
                        }
                        return false; // no match found