operator[] -> insert() (probably more efficient)
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 21 Aug 2003 23:19:25 +0000 (23:19 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 21 Aug 2003 23:19:25 +0000 (23:19 +0000)
ginac/ex.cpp
ginac/normal.cpp

index e53cbd332958194f9cda094e716db7788e02f5f8..e3e54c132d2d8fb27348d56efc457e1fdf6b4ff8 100644 (file)
@@ -126,7 +126,7 @@ ex ex::subs(const lst & ls, const lst & lr, unsigned options) const
        // Convert the lists to a map
        exmap m;
        for (lst::const_iterator its = ls.begin(), itr = lr.begin(); its != ls.end(); ++its, ++itr) {
-               m[*its] = *itr;
+               m.insert(std::make_pair(*its, *itr));
 
                // Search for products and powers in the expressions to be substituted
                // (for an optimization in expairseq::subs())
@@ -148,7 +148,7 @@ ex ex::subs(const ex & e, unsigned options) const
        if (e.info(info_flags::relation_equal)) {
                exmap m;
                const ex & s = e.lhs();
-               m[s] = e.rhs();
+               m.insert(std::make_pair(s, e.rhs()));
                if (is_exactly_a<mul>(s) || is_exactly_a<power>(s))
                        options |= subs_options::pattern_is_product;
                return bp->subs(m, options);
@@ -163,7 +163,7 @@ ex ex::subs(const ex & e, unsigned options) const
                if (!r.info(info_flags::relation_equal))
                        throw(std::invalid_argument("basic::subs(ex): argument must be a list of equations"));
                const ex & s = r.lhs();
-               m[s] = r.rhs();
+               m.insert(std::make_pair(s, r.rhs()));
 
                // Search for products and powers in the expressions to be substituted
                // (for an optimization in expairseq::subs())
index 2603086a743b495b84033855ef59c822aca7af97..8d9f462140dd42fdcdefa4e00e50eb602b85e049 100644 (file)
@@ -1696,8 +1696,8 @@ static ex replace_with_symbol(const ex & e, exmap & repl, exmap & rev_lookup)
        // because subs() is not recursive
        ex es = (new symbol)->setflag(status_flags::dynallocated);
        ex e_replaced = e.subs(repl, subs_options::no_pattern);
-       repl[es] = e_replaced;
-       rev_lookup[e_replaced] = es;
+       repl.insert(std::make_pair(es, e_replaced));
+       rev_lookup.insert(std::make_pair(e_replaced, es));
        return es;
 }