Use emplace() for associative containers.
* HACKING: Adjust requirements. g++4.8 is now OK for all our targets. * iface/dve2/dve2.cc, src/dstarparse/dstarparse.yy src/dstarparse/nsa2tgba.cc, src/graph/ngraph.hh, src/ltlast/atomic_prop.cc, src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlvisit/mark.cc, src/ltlvisit/relabel.cc, src/taalgos/emptinessta.cc, src/taalgos/tgba2ta.cc, src/tgba/tgbaexplicit.hh, src/tgba/tgbagraph.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbatba.cc, src/tgbaalgos/cycles.cc, src/tgbaalgos/degen.cc, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/emptiness.cc, src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/magic.cc, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/reachiter.cc, src/tgbaalgos/scc.cc, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/se05.cc, src/tgbaalgos/simulation.cc, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03opt.cc, src/tgbaalgos/weight.cc: Use emplace() instead of insert(make_pair(...)) or insert(...::value_type(...)).
This commit is contained in:
parent
1eaaf8832a
commit
fd5fbda4dd
35 changed files with 77 additions and 104 deletions
|
|
@ -66,8 +66,7 @@ namespace spot
|
|||
enumerate_cycles::tagged_state
|
||||
enumerate_cycles::tag_state(const state* s)
|
||||
{
|
||||
std::pair<tagged_state, bool> p =
|
||||
tags_.insert(std::make_pair(s, state_info()));
|
||||
auto p = tags_.emplace(s, state_info());
|
||||
if (!p.second)
|
||||
s->destroy();
|
||||
return p.first;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace spot
|
|||
union_ |= set;
|
||||
}
|
||||
cache_entry e(common, union_);
|
||||
return cache_.insert(std::make_pair(s, e)).first;
|
||||
return cache_.emplace(s, e).first;
|
||||
}
|
||||
|
||||
// Intersection of all outgoing acceptance sets
|
||||
|
|
@ -144,8 +144,7 @@ namespace spot
|
|||
|
||||
bool check(const state* s)
|
||||
{
|
||||
std::pair<cache_t::iterator, bool> p =
|
||||
cache_.insert(std::make_pair(s, false));
|
||||
auto p = cache_.emplace(s, false);
|
||||
if (p.second)
|
||||
{
|
||||
bdd all = a_->all_acceptance_conditions();
|
||||
|
|
@ -569,9 +568,7 @@ namespace spot
|
|||
|
||||
if (use_lvl_cache)
|
||||
{
|
||||
std::pair<lvl_cache_t::iterator, bool> res =
|
||||
lvl_cache.insert(lvl_cache_t::value_type(d.first,
|
||||
d.second));
|
||||
auto res = lvl_cache.emplace(d.first, d.second);
|
||||
|
||||
if (!res.second)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -312,10 +312,10 @@ namespace spot
|
|||
|
||||
transition t(i, one, j);
|
||||
d.transid[t] = ++d.nvars;
|
||||
d.revtransid.insert(dict::rev_map::value_type(d.nvars, t));
|
||||
d.revtransid.emplace(d.nvars, t);
|
||||
int ta = d.transacc[t] =
|
||||
state_based_ ? transacc : ++d.nvars;
|
||||
d.revtransacc.insert(dict::rev_map::value_type(ta, t));
|
||||
d.revtransacc.emplace(ta, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,8 +411,7 @@ namespace spot
|
|||
|
||||
transition t(i, one, j);
|
||||
d.transid[t] = ++d.nvars;
|
||||
d.revtransid.insert(dict::rev_map::
|
||||
value_type(d.nvars, t));
|
||||
d.revtransid.emplace(d.nvars, t);
|
||||
|
||||
// Create the variable for the accepting transition
|
||||
// immediately afterwards. It helps parsing the
|
||||
|
|
@ -421,8 +420,7 @@ namespace spot
|
|||
{
|
||||
transition_acc ta(i, one, d.cand_acc[n], j);
|
||||
d.transaccid[ta] = ++d.nvars;
|
||||
d.revtransaccid.insert(dict::rev_acc_map::
|
||||
value_type(d.nvars, ta));
|
||||
d.revtransaccid.emplace(d.nvars, ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -443,8 +441,7 @@ namespace spot
|
|||
|
||||
transition_acc ta(i, one, d.cand_acc[n], j);
|
||||
d.transaccid[ta] = d.nvars;
|
||||
d.revtransaccid.insert(dict::rev_acc_map::
|
||||
value_type(d.nvars, ta));
|
||||
d.revtransaccid.emplace(d.nvars, ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -459,8 +456,7 @@ namespace spot
|
|||
|
||||
transition t(i, one, j);
|
||||
d.transid[t] = ++d.nvars;
|
||||
d.revtransid.insert(dict::rev_map::
|
||||
value_type(d.nvars, t));
|
||||
d.revtransid.emplace(d.nvars, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ namespace spot
|
|||
|
||||
assert(s->compare(i->s) == 0);
|
||||
src = res->new_state();
|
||||
seen.insert(std::make_pair(i->s, src));
|
||||
seen.emplace(i->s, src);
|
||||
|
||||
for (; i != l->end();)
|
||||
{
|
||||
|
|
@ -355,7 +355,7 @@ namespace spot
|
|||
s = the_next;
|
||||
|
||||
|
||||
auto p = seen.insert(std::make_pair(next, 0));
|
||||
auto p = seen.emplace(next, 0);
|
||||
if (p.second)
|
||||
p.first->second = res->new_state();
|
||||
dst = p.first->second;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace spot
|
|||
// We do not need SUCC from now on.
|
||||
|
||||
// Are we going to a new state?
|
||||
auto p = ecs_->h.insert(std::make_pair(dest, num + 1));
|
||||
auto p = ecs_->h.emplace(dest, num + 1);
|
||||
if (p.second)
|
||||
{
|
||||
// Yes. Bump number, stack the stack, and register its
|
||||
|
|
|
|||
|
|
@ -1749,7 +1749,7 @@ namespace spot
|
|||
}
|
||||
|
||||
f->clone();
|
||||
return ltl_bdd_.insert(std::make_pair(ff, t)).first->second;
|
||||
return ltl_bdd_.emplace(ff, t).first->second;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1974,7 +1974,7 @@ namespace spot
|
|||
if (b2f_.find(t.symbolic) == b2f_.end())
|
||||
b2f_[t.symbolic] = f;
|
||||
|
||||
return f2b_.insert(std::make_pair(f->clone(), t)).first->second;
|
||||
return f2b_.emplace(f->clone(), t).first->second;
|
||||
}
|
||||
|
||||
const formula*
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ namespace spot
|
|||
void add_new_state(const state* s, color c)
|
||||
{
|
||||
assert(h.find(s) == h.end());
|
||||
h.insert(std::make_pair(s, c));
|
||||
h.emplace(s, c);
|
||||
}
|
||||
|
||||
void pop_notify(const state*) const
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ namespace spot
|
|||
{
|
||||
ndfsr_trace << a_->format_state(i->source) << " (-> "
|
||||
<< a_->format_state(i->dest) << ") ";
|
||||
target.insert(std::make_pair(i->source, *i));
|
||||
target.emplace(i->source, *i);
|
||||
}
|
||||
}
|
||||
ndfsr_trace << std::endl;
|
||||
|
|
@ -605,7 +605,7 @@ namespace spot
|
|||
<< a_->format_state(begin) << std::endl;
|
||||
transition tmp;
|
||||
tmp.source = tmp.dest = 0; // Initialize to please GCC 4.0.1 (Darwin).
|
||||
target.insert(std::make_pair(begin, tmp));
|
||||
target.emplace(begin, tmp);
|
||||
min_path<true> s(this, a_, target, h_);
|
||||
const state* res = s.search(current.dest->clone(), run->cycle);
|
||||
assert(res);
|
||||
|
|
@ -623,7 +623,7 @@ namespace spot
|
|||
// Register all states from the cycle as target of the BFS.
|
||||
for (tgba_run::steps::const_iterator i = run->cycle.begin();
|
||||
i != run->cycle.end(); ++i)
|
||||
target.insert(std::make_pair(i->s, tmp));
|
||||
target.emplace(i->s, tmp);
|
||||
|
||||
const state* prefix_start = a_->get_init_state();
|
||||
// There are two cases: either the initial state is already on
|
||||
|
|
|
|||
|
|
@ -203,8 +203,7 @@ namespace spot
|
|||
}
|
||||
|
||||
dst = si->current_state();
|
||||
std::pair<seen_map::iterator, bool> res =
|
||||
seen.insert(std::make_pair(dst, n));
|
||||
auto res = seen.emplace(dst, n);
|
||||
if (!res.second)
|
||||
{
|
||||
// The state has already been seen.
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ namespace spot
|
|||
self_loops_ = 0;
|
||||
state* init = aut_->get_init_state();
|
||||
num_ = -1;
|
||||
h_.insert(std::make_pair(init, num_));
|
||||
h_.emplace(init, num_);
|
||||
root_.emplace_front(num_);
|
||||
arc_acc_.push(bddfalse);
|
||||
arc_cond_.push(bddfalse);
|
||||
|
|
@ -196,7 +196,7 @@ namespace spot
|
|||
// Record the transition between the SCC being popped
|
||||
// and the previous SCC.
|
||||
if (!root_.empty())
|
||||
root_.front().succ.insert(std::make_pair(num, cond));
|
||||
root_.front().succ.emplace(num, cond);
|
||||
}
|
||||
|
||||
aut_->release_iter(succ);
|
||||
|
|
@ -223,7 +223,7 @@ namespace spot
|
|||
{
|
||||
// Yes. Number it, stack it, and register its successors
|
||||
// for later processing.
|
||||
h_.insert(std::make_pair(dest, --num_));
|
||||
h_.emplace(dest, --num_);
|
||||
root_.emplace_front(num_);
|
||||
arc_acc_.push(acc);
|
||||
arc_cond_.push(cond);
|
||||
|
|
@ -244,7 +244,7 @@ namespace spot
|
|||
// dest SCC labelled with cond.
|
||||
succ_type::iterator i = root_.front().succ.find(dest);
|
||||
if (i == root_.front().succ.end())
|
||||
root_.front().succ.insert(std::make_pair(dest, cond));
|
||||
root_.front().succ.emplace(dest, cond);
|
||||
else
|
||||
i->second |= cond;
|
||||
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ namespace spot
|
|||
// turn makes sure we preserve the acceptance condition
|
||||
// ordering (which matters for degeneralization).
|
||||
for (BDD c = useful.id(); c != 1; c = bdd_low(c))
|
||||
remap_table[n].insert(std::make_pair(bdd_var(c), --num));
|
||||
remap_table[n].emplace(bdd_var(c), --num);
|
||||
|
||||
max_table[n] = max_num;
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ namespace spot
|
|||
// turn makes sure we preserve the acceptance condition
|
||||
// ordering (which matters for degeneralization).
|
||||
for (BDD c = useful.id(); c != 1; c = bdd_low(c))
|
||||
remap_table[n].insert(std::make_pair(bdd_var(c), --num));
|
||||
remap_table[n].emplace(bdd_var(c), --num);
|
||||
|
||||
max_table[n] = max_num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ namespace spot
|
|||
int i = phc->erase(ps);
|
||||
assert(i == 1);
|
||||
(void)i;
|
||||
ph->insert(std::make_pair(ps, c));
|
||||
ph->emplace(ps, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -540,7 +540,7 @@ namespace spot
|
|||
if (c == CYAN)
|
||||
hc.insert(s);
|
||||
else
|
||||
h.insert(std::make_pair(s, c));
|
||||
h.emplace(s, c);
|
||||
}
|
||||
|
||||
void pop_notify(const state*) const
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ namespace spot
|
|||
map_constraint& feed_me)
|
||||
{
|
||||
for (auto& p: list)
|
||||
feed_me.insert(std::make_pair(std::make_pair(std::get<0>(p),
|
||||
std::get<1>(p)),
|
||||
std::get<2>(p)));
|
||||
feed_me.emplace(std::make_pair(std::get<0>(p),
|
||||
std::get<1>(p)),
|
||||
std::get<2>(p));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ namespace spot
|
|||
void add_new_state(const state* s, color c)
|
||||
{
|
||||
assert(h.find(s) == h.end());
|
||||
h.insert(std::make_pair(s, std::make_pair(c, bddfalse)));
|
||||
h.emplace(s, std::make_pair(c, bddfalse));
|
||||
}
|
||||
|
||||
void pop_notify(const state*) const
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ namespace spot
|
|||
{
|
||||
assert(c != CYAN);
|
||||
std::pair<hash_type::iterator, bool> p;
|
||||
p = ph->insert(std::make_pair(ps, std::make_pair(c, *acc)));
|
||||
p = ph->emplace(ps, std::make_pair(c, *acc));
|
||||
assert(p.second);
|
||||
acc = &(p.first->second.second);
|
||||
int i = phc->erase(ps);
|
||||
|
|
@ -536,7 +536,9 @@ namespace spot
|
|||
assert(hc.find(s) == hc.end() && h.find(s) == h.end());
|
||||
assert(c == CYAN);
|
||||
(void)c;
|
||||
hc.insert(std::make_pair(s, std::make_pair(w, bddfalse)));
|
||||
hc.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(s),
|
||||
std::forward_as_tuple(w, bddfalse));
|
||||
}
|
||||
|
||||
void pop_notify(const state*) const
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace spot
|
|||
{
|
||||
weight::weight_vector::iterator it = pm->find(v);
|
||||
if (it == pm->end())
|
||||
pm->insert(std::make_pair(v, 1));
|
||||
pm->emplace(v, 1);
|
||||
else
|
||||
++(it->second);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue