c++11: replace push(Type(args...)) by emplace(args...)
This of course concerns push_back and push_front as well. * src/bin/common_finput.cc, src/bin/dstar2tgba.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltlfilt.cc, src/dstarparse/dstarparse.yy, src/kripkeparse/kripkeparse.yy, src/ltlast/formula.cc, src/ltlparse/ltlparse.yy, src/misc/minato.cc, src/neverparse/neverclaimparse.yy, src/priv/bddalloc.cc, src/ta/ta.cc, src/taalgos/emptinessta.cc, src/tgba/taatgba.cc, src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/sccstack.cc, src/tgbaalgos/magic.cc, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/rundotdec.cc, src/tgbaalgos/scc.cc, src/tgbaalgos/se05.cc, src/tgbaalgos/simulation.cc, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03opt.cc, src/tgbaparse/tgbaparse.yy: Use emplace to make the code less verbose and avoid creating temporaries.
This commit is contained in:
parent
e0bbc2655d
commit
49c66c6319
27 changed files with 189 additions and 202 deletions
|
|
@ -173,7 +173,7 @@ namespace spot
|
|||
arc.push(bddfalse);
|
||||
tgba_succ_iterator* iter = ecs_->aut->succ_iter(init);
|
||||
iter->first();
|
||||
todo.push(pair_state_iter(init, iter));
|
||||
todo.emplace(init, iter);
|
||||
inc_depth();
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ namespace spot
|
|||
arc.push(acc);
|
||||
tgba_succ_iterator* iter = ecs_->aut->succ_iter(dest);
|
||||
iter->first();
|
||||
todo.push(pair_state_iter(dest, iter));
|
||||
todo.emplace(dest, iter);
|
||||
inc_depth();
|
||||
continue;
|
||||
}
|
||||
|
|
@ -329,8 +329,8 @@ namespace spot
|
|||
{
|
||||
for (auto iter: shy->ecs_->aut->succ(s))
|
||||
{
|
||||
q.push_back(successor(iter->current_acceptance_conditions(),
|
||||
iter->current_state()));
|
||||
q.emplace_back(iter->current_acceptance_conditions(),
|
||||
iter->current_state());
|
||||
shy->inc_depth();
|
||||
shy->inc_transitions();
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ namespace spot
|
|||
const state* i = ecs_->aut->get_init_state();
|
||||
ecs_->h->insert(i, ++num);
|
||||
ecs_->root.push(num);
|
||||
todo.push_back(todo_item(i, num, this));
|
||||
todo.emplace_back(i, num, this);
|
||||
inc_depth(1);
|
||||
}
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ namespace spot
|
|||
ecs_->h->insert(succ.s, ++num);
|
||||
ecs_->root.push(num);
|
||||
arc.push(succ.acc);
|
||||
todo.push_back(todo_item(succ.s, num, this));
|
||||
todo.emplace_back(succ.s, num, this);
|
||||
pos = todo.back().q.begin();
|
||||
inc_depth();
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014 Laboratoire de Recherche et Developpement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -49,7 +52,7 @@ namespace spot
|
|||
void
|
||||
scc_stack::push(int index)
|
||||
{
|
||||
s.push_front(connected_component(index));
|
||||
s.emplace_front(index);
|
||||
}
|
||||
|
||||
std::list<const state*>&
|
||||
|
|
|
|||
|
|
@ -148,12 +148,12 @@ namespace spot
|
|||
private:
|
||||
|
||||
void push(stack_type& st, const state* s,
|
||||
const bdd& label, const bdd& acc)
|
||||
const bdd& label, const bdd& acc)
|
||||
{
|
||||
inc_depth();
|
||||
tgba_succ_iterator* i = a_->succ_iter(s);
|
||||
i->first();
|
||||
st.push_front(stack_item(s, i, label, acc));
|
||||
st.emplace_front(s, i, label, acc);
|
||||
}
|
||||
|
||||
void pop(stack_type& st)
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ namespace spot
|
|||
seen.insert(start);
|
||||
tgba_succ_iterator* i = a_->succ_iter(start);
|
||||
i->first();
|
||||
st1.push_front(stack_item(start, i, bddfalse, bddfalse));
|
||||
st1.emplace_front(start, i, bddfalse, bddfalse);
|
||||
|
||||
while (!st1.empty())
|
||||
{
|
||||
|
|
@ -292,7 +292,7 @@ namespace spot
|
|||
seen.insert(s_prime);
|
||||
tgba_succ_iterator* i = a_->succ_iter(s_prime);
|
||||
i->first();
|
||||
st1.push_front(stack_item(s_prime, i, label, acc));
|
||||
st1.emplace_front(s_prime, i, label, acc);
|
||||
}
|
||||
else if ((acc & covered_acc) != acc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2011 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -30,10 +33,10 @@ namespace spot
|
|||
int n = 1;
|
||||
for (tgba_run::steps::const_iterator i = run->prefix.begin();
|
||||
i != run->prefix.end(); ++i, ++n)
|
||||
map_[i->s].first.push_back(step_num(i, n));
|
||||
map_[i->s].first.emplace_back(i, n);
|
||||
for (tgba_run::steps::const_iterator i = run->cycle.begin();
|
||||
i != run->cycle.end(); ++i, ++n)
|
||||
map_[i->s].second.push_back(step_num(i, n));
|
||||
map_[i->s].second.emplace_back(i, n);
|
||||
}
|
||||
|
||||
tgba_run_dotty_decorator::~tgba_run_dotty_decorator()
|
||||
|
|
@ -55,19 +58,17 @@ namespace spot
|
|||
std::string sep = "(";
|
||||
bool in_prefix = false;
|
||||
bool in_cycle = false;
|
||||
for (step_set::const_iterator j = i->second.first.begin();
|
||||
j != i->second.first.end(); ++j)
|
||||
for (auto j: i->second.first)
|
||||
{
|
||||
os << sep << j->second;
|
||||
os << sep << j.second;
|
||||
sep = ", ";
|
||||
in_prefix = true;
|
||||
}
|
||||
if (sep == ", ")
|
||||
sep = "; ";
|
||||
for (step_set::const_iterator j = i->second.second.begin();
|
||||
j != i->second.second.end(); ++j)
|
||||
for (auto j: i->second.second)
|
||||
{
|
||||
os << sep << j->second;
|
||||
os << sep << j.second;
|
||||
sep = ", ";
|
||||
in_cycle = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,12 +147,12 @@ namespace spot
|
|||
state* init = aut_->get_init_state();
|
||||
num_ = -1;
|
||||
h_.insert(std::make_pair(init, num_));
|
||||
root_.push_front(scc(num_));
|
||||
root_.emplace_front(num_);
|
||||
arc_acc_.push(bddfalse);
|
||||
arc_cond_.push(bddfalse);
|
||||
tgba_succ_iterator* iter = aut_->succ_iter(init);
|
||||
iter->first();
|
||||
todo_.push(pair_state_iter(init, iter));
|
||||
todo_.emplace(init, iter);
|
||||
}
|
||||
|
||||
while (!todo_.empty())
|
||||
|
|
@ -224,12 +224,12 @@ namespace spot
|
|||
// Yes. Number it, stack it, and register its successors
|
||||
// for later processing.
|
||||
h_.insert(std::make_pair(dest, --num_));
|
||||
root_.push_front(scc(num_));
|
||||
root_.emplace_front(num_);
|
||||
arc_acc_.push(acc);
|
||||
arc_cond_.push(cond);
|
||||
tgba_succ_iterator* iter = aut_->succ_iter(dest);
|
||||
iter->first();
|
||||
todo_.push(pair_state_iter(dest, iter));
|
||||
todo_.emplace(dest, iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace spot
|
|||
inc_depth();
|
||||
tgba_succ_iterator* i = a_->succ_iter(s);
|
||||
i->first();
|
||||
st.push_front(stack_item(s, i, label, acc));
|
||||
st.emplace_front(s, i, label, acc);
|
||||
}
|
||||
|
||||
void pop(stack_type& st)
|
||||
|
|
|
|||
|
|
@ -1317,7 +1317,7 @@ namespace spot
|
|||
bdd sig = dont_care_compute_sig(src);
|
||||
dont_care_bdd_lstate[sig].push_back(src);
|
||||
dont_care_state2sig[src] = sig;
|
||||
dont_care_now_to_now.push_back(std::make_pair(sig, it->second));
|
||||
dont_care_now_to_now.emplace_back(sig, it->second);
|
||||
class2state[it->second] = it->first;
|
||||
|
||||
sig = compute_sig(src);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace spot
|
|||
inc_depth();
|
||||
tgba_succ_iterator* i = a_->succ_iter(s);
|
||||
i->first();
|
||||
st.push_front(stack_item(s, i, label, acc));
|
||||
st.emplace_front(s, i, label, acc);
|
||||
}
|
||||
|
||||
void pop(stack_type& st)
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ namespace spot
|
|||
inc_depth();
|
||||
tgba_succ_iterator* i = a_->succ_iter(s);
|
||||
i->first();
|
||||
st.push_front(stack_item(s, i, label, acc));
|
||||
st.emplace_front(s, i, label, acc);
|
||||
}
|
||||
|
||||
void pop(stack_type& st)
|
||||
|
|
@ -321,7 +321,7 @@ namespace spot
|
|||
typedef std::pair<bdd, unsigned> cond_level;
|
||||
std::stack<cond_level> condition_stack;
|
||||
unsigned depth = 1;
|
||||
condition_stack.push(cond_level(bddfalse, 0));
|
||||
condition_stack.emplace(bddfalse, 0);
|
||||
|
||||
while (!st_red.empty())
|
||||
{
|
||||
|
|
@ -376,7 +376,7 @@ namespace spot
|
|||
{
|
||||
bdd old = acu;
|
||||
acu |= acc;
|
||||
condition_stack.push(cond_level(acu - old, depth));
|
||||
condition_stack.emplace(acu - old, depth);
|
||||
}
|
||||
++depth;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue