Fixed bug in ::match.
authorChris Dams <Chris.Dams@mi.infn.it>
Thu, 20 Apr 2006 20:08:06 +0000 (20:08 +0000)
committerChris Dams <Chris.Dams@mi.infn.it>
Thu, 20 Apr 2006 20:08:06 +0000 (20:08 +0000)
ginac/expairseq.cpp

index 5652d89c30b4b3772e10af0089fca66e77a6ce8c..9d72a7873c45ee23a4a4ceb0236a62571dfafe09 100644 (file)
@@ -395,10 +395,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