From d27f0faccba9e6d846072df8930c562db319a919 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 21 Aug 2003 23:19:25 +0000 Subject: [PATCH] operator[] -> insert() (probably more efficient) --- ginac/ex.cpp | 6 +++--- ginac/normal.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ginac/ex.cpp b/ginac/ex.cpp index e53cbd33..e3e54c13 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -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(s) || is_exactly_a(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()) diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 2603086a..8d9f4621 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -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; } -- 2.47.0