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:
Alexandre Duret-Lutz 2014-07-31 16:59:47 +02:00
parent 1eaaf8832a
commit fd5fbda4dd
35 changed files with 77 additions and 104 deletions

23
HACKING
View file

@ -229,25 +229,12 @@ C++11
----- -----
Spot uses some C++11 features, and therefore requires a C++11 Spot uses some C++11 features, and therefore requires a C++11
compiler. However (1) fully C++11-compliant compilers are compiler. The code relies on features that are not available in
not yet well deployed, and (2) development tools have yet version of g++ older than 4.8, so this is our minimum requirement
to be updated to provide suitable C++11 support. For instance for now. Avoid features that require 4.9.
Swig 2.0, which we use for the Python bindings, does not
understand C++11. The upcoming release of Swig 3 has better
support for C++11, we should switch to it as soon as possible.
In the meantime, try to keep the C++11-specific syntax in the *.cc Reasonably recent versions of clang should work as well. Our
files as much as possible. build farm has clang++ 3.5.
Use only C++11 features that are available in clang 3.1 and g++ 4.6:
- http://gcc.gnu.org/projects/cxx0x.html
- http://clang.llvm.org/cxx_status.html
Library interfaces that should not be used:
- emplace() is not implemented for associative containers
(std::map, std::set, and their unordered ffriends) is
before g++ 4.8. Use
x.insert(std::make_pair(...)) instead of x.emplace(...)
Encoding Encoding
-------- --------

View file

@ -353,9 +353,7 @@ namespace spot
{ {
int enum_count = d->get_state_variable_type_value_count(i); int enum_count = d->get_state_variable_type_value_count(i);
for (int j = 0; j < enum_count; ++j) for (int j = 0; j < enum_count; ++j)
enum_map[i] enum_map[i].emplace(d->get_state_variable_type_value(i, j), j);
.insert(std::make_pair(d->get_state_variable_type_value(i, j),
j));
} }
for (ltl::atomic_prop_set::const_iterator ap = aps->begin(); for (ltl::atomic_prop_set::const_iterator ap = aps->begin();

View file

@ -259,7 +259,7 @@ transitions:
| transitions NUMBER opt_eols | transitions NUMBER opt_eols
{ {
std::pair<map_t::iterator, bool> i = std::pair<map_t::iterator, bool> i =
result.dest_map.insert(std::make_pair($2, *result.cur_guard)); result.dest_map.emplace($2, *result.cur_guard);
if (!i.second) if (!i.second)
i.first->second |= *result.cur_guard; i.first->second |= *result.cur_guard;
++result.cur_guard; ++result.cur_guard;

View file

@ -175,8 +175,7 @@ namespace spot
build_state d(dlabel, pend); build_state d(dlabel, pend);
// Have we already seen this destination? // Have we already seen this destination?
int dest; int dest;
std::pair<bs2num_map::iterator, bool> dres = auto dres = bs2num.emplace(d, 0);
bs2num.insert(bs2num_map::value_type(d, 0));
if (!dres.second) if (!dres.second)
{ {
dest = dres.first->second; dest = dres.first->second;
@ -199,8 +198,7 @@ namespace spot
build_state d(label(a, i->current_state()), pend); build_state d(label(a, i->current_state()), pend);
// Have we already seen this destination? // Have we already seen this destination?
int dest; int dest;
std::pair<bs2num_map::iterator, bool> dres = auto dres = bs2num.emplace(d, 0);
bs2num.insert(bs2num_map::value_type(d, 0));
if (!dres.second) if (!dres.second)
{ {
dest = dres.first->second; dest = dres.first->second;

View file

@ -64,7 +64,7 @@ namespace spot
template <typename... Args> template <typename... Args>
state new_state(name n, Args&&... args) state new_state(name n, Args&&... args)
{ {
auto p = name_to_state.insert(std::make_pair(n, 0U)); auto p = name_to_state.emplace(n, 0U);
if (p.second) if (p.second)
{ {
unsigned s = g_.new_state(std::forward<Args>(args)...); unsigned s = g_.new_state(std::forward<Args>(args)...);
@ -81,7 +81,7 @@ namespace spot
/// \return true iff the newname was already used. /// \return true iff the newname was already used.
bool alias_state(state s, name newname) bool alias_state(state s, name newname)
{ {
return !name_to_state.insert(std::make_pair(newname, s)).second; return !name_to_state.emplace(newname, s).second;
} }
state get_state(name n) const state get_state(name n) const

View file

@ -91,7 +91,7 @@ namespace spot
atomic_prop::instance(const std::string& name, environment& env) atomic_prop::instance(const std::string& name, environment& env)
{ {
const atomic_prop* ap; const atomic_prop* ap;
auto ires = instances.insert(std::make_pair(key(name, &env), nullptr)); auto ires = instances.emplace(key(name, &env), nullptr);
if (!ires.second) if (!ires.second)
ap = ires.first->second; ap = ires.first->second;
else else

View file

@ -504,8 +504,7 @@ namespace spot
} }
const binop* res; const binop* res;
auto ires = instances.insert(std::make_pair(key(op, first, second), auto ires = instances.emplace(key(op, first, second), nullptr);
nullptr));
if (!ires.second) if (!ires.second)
{ {
// This instance already exists. // This instance already exists.

View file

@ -237,8 +237,7 @@ namespace spot
} }
const formula* res; const formula* res;
auto ires = instances.insert(std::make_pair(key(op, child, min, max), auto ires = instances.emplace(key(op, child, min, max), nullptr);
nullptr));
if (!ires.second) if (!ires.second)
{ {
// This instance already exists. // This instance already exists.

View file

@ -595,7 +595,7 @@ namespace spot
const multop* res; const multop* res;
// Insert the key with the dummy nullptr just // Insert the key with the dummy nullptr just
// to check if p already exists. // to check if p already exists.
auto ires = instances.insert(std::make_pair(key(op, v), nullptr)); auto ires = instances.emplace(key(op, v), nullptr);
if (!ires.second) if (!ires.second)
{ {
// The instance did already exists. Free v. // The instance did already exists. Free v.

View file

@ -300,7 +300,7 @@ namespace spot
} }
const unop* res; const unop* res;
auto ires = instances.insert(std::make_pair(key(op, child), nullptr)); auto ires = instances.emplace(key(op, child), nullptr);
if (!ires.second) if (!ires.second)
{ {
// This instance already exists. // This instance already exists.

View file

@ -114,8 +114,7 @@ namespace spot
switch (bo->op()) switch (bo->op())
{ {
case binop::EConcatMarked: case binop::EConcatMarked:
empairs.insert(std::make_pair(bo->first(), empairs.emplace(bo->first(), bo->second());
bo->second()));
// fall through // fall through
case binop::Xor: case binop::Xor:
case binop::Implies: case binop::Implies:

View file

@ -110,8 +110,7 @@ namespace spot
const formula* rename(const formula* old) const formula* rename(const formula* old)
{ {
std::pair<map::iterator, bool> r = auto r = newname.emplace(old, nullptr);
newname.insert(map::value_type(old, 0));
if (!r.second) if (!r.second)
{ {
return r.first->second->clone(); return r.first->second->clone();
@ -327,9 +326,7 @@ namespace spot
void void
recurse(const formula* f) recurse(const formula* f)
{ {
std::pair<fgraph::iterator, bool> i = auto i = g.emplace(f, succ_vec());
g.insert(fgraph::value_type(f, succ_vec()));
if (!s.empty()) if (!s.empty())
{ {
const formula* top = s.top(); const formula* top = s.top();
@ -356,6 +353,10 @@ namespace spot
{ {
unsigned num; // serial number, in pre-order unsigned num; // serial number, in pre-order
unsigned low; // lowest number accessible via unstacked descendants unsigned low; // lowest number accessible via unstacked descendants
data_entry(unsigned num = 0, unsigned low = 0)
: num(num), low(low)
{
}
}; };
typedef std::unordered_map<const formula*, data_entry, typedef std::unordered_map<const formula*, data_entry,
const formula_ptr_hash> fmap_t; const formula_ptr_hash> fmap_t;
@ -410,9 +411,9 @@ namespace spot
// std::cerr << " grand parent is " // std::cerr << " grand parent is "
// << to_string(e.grand_parent) // << to_string(e.grand_parent)
// << "\n child is " << to_string(child) << '\n'; // << "\n child is " << to_string(child) << '\n';
data_entry d = { num, num }; auto i = data.emplace(std::piecewise_construct,
std::pair<fmap_t::iterator, bool> i = std::forward_as_tuple(child),
data.insert(fmap_t::value_type(child, d)); std::forward_as_tuple(num, num));
if (i.second) // New destination. if (i.second) // New destination.
{ {
++num; ++num;

View file

@ -106,7 +106,7 @@ namespace spot
state_ta_product* init = new state_ta_product( state_ta_product* init = new state_ta_product(
(ta_init_it_->current_state()), kripke_init_state->clone()); (ta_init_it_->current_state()), kripke_init_state->clone());
if (!h.insert(std::make_pair(init, num + 1)).second) if (!h.emplace(init, num + 1).second)
{ {
init->destroy(); init->destroy();
continue; continue;
@ -216,7 +216,7 @@ namespace spot
// We do not need SUCC from now on. // We do not need SUCC from now on.
// Are we going to a new state? // Are we going to a new state?
auto p = h.insert(std::make_pair(dest, num + 1)); auto p = h.emplace(dest, num + 1);
if (p.second) if (p.second)
{ {
// Number it, stack it, and register its successors // Number it, stack it, and register its successors
@ -427,7 +427,7 @@ namespace spot
state* init = ta_init_it_.front(); state* init = ta_init_it_.front();
ta_init_it_.pop(); ta_init_it_.pop();
if (!h.insert(std::make_pair(init, num + 1)).second) if (!h.emplace(init, num + 1).second)
{ {
init->destroy(); init->destroy();
continue; continue;

View file

@ -193,7 +193,7 @@ namespace spot
down_cast<state_ta_explicit*> (init_set.top()); down_cast<state_ta_explicit*> (init_set.top());
init_set.pop(); init_set.pop();
if (!h.insert(std::make_pair(init, num + 1)).second) if (!h.emplace(init, num + 1).second)
{ {
init->destroy(); init->destroy();
continue; continue;

View file

@ -431,7 +431,7 @@ namespace spot
last_dest = dest; last_dest = dest;
dmi = dm.find(dest); dmi = dm.find(dest);
if (dmi == dm.end()) if (dmi == dm.end())
dmi = dm.insert(std::make_pair(dest, acc_map())).first; dmi = dm.emplace(dest, acc_map()).first;
} }
int acc = t1->acceptance_conditions.id(); int acc = t1->acceptance_conditions.id();
typename acc_map::iterator it = dmi->second.find(acc); typename acc_map::iterator it = dmi->second.find(acc);
@ -460,8 +460,7 @@ namespace spot
if (j != alias_.end()) if (j != alias_.end())
return j->second; return j->second;
State* res = State* res = &(ls_.emplace(name, State(name)).first->second);
&(ls_.insert(std::make_pair(name, State(name))).first->second);
sl_[res] = name; sl_[res] = name;
// The first state we add is the initial state. // The first state we add is the initial state.
// It can also be overridden with set_init_state(). // It can also be overridden with set_init_state().

View file

@ -386,7 +386,7 @@ namespace spot
} }
key_t k(t->dst, t->acc.id()); key_t k(t->dst, t->acc.id());
auto p = trmap.insert(make_pair(k, t.trans())); auto p = trmap.emplace(k, t.trans());
if (!p.second) if (!p.second)
{ {
// A previous transitions exist for k, merge the // A previous transitions exist for k, merge the

View file

@ -1184,8 +1184,8 @@ namespace spot
p.second, false); p.second, false);
state_complement* s2 = new state_complement(e->clone(), e->clone(), state_complement* s2 = new state_complement(e->clone(), e->clone(),
p.second, true); p.second, true);
succ_list.insert(std::make_pair(p.first, s1)); succ_list.emplace(p.first, s1);
succ_list.insert(std::make_pair(p.first, s2)); succ_list.emplace(p.first, s2);
} }
} }
else else
@ -1210,7 +1210,7 @@ namespace spot
{ {
st = new state_complement(e->clone(), e->clone(), st = new state_complement(e->clone(), e->clone(),
p.second, true); p.second, true);
succ_list.insert(std::make_pair(p.first, st)); succ_list.emplace(p.first, st);
} }
condition = the_acceptance_cond_; condition = the_acceptance_cond_;
} }
@ -1219,7 +1219,7 @@ namespace spot
for (auto& p: tr->second) for (auto& p: tr->second)
{ {
st = new state_complement(newI, newJ, p.second, true); st = new state_complement(newI, newJ, p.second, true);
succ_list.insert(std::make_pair(p.first, st)); succ_list.emplace(p.first, st);
} }
} }
delete newI; delete newI;
@ -1234,7 +1234,7 @@ namespace spot
{ {
st = new state_complement(pending->clone(), e->clone(), st = new state_complement(pending->clone(), e->clone(),
p.second, true); p.second, true);
succ_list.insert(std::make_pair(p.first, st)); succ_list.emplace(p.first, st);
} }
delete pending; delete pending;

View file

@ -315,8 +315,8 @@ namespace spot
transmap_t::iterator id = transmap_.find(key); transmap_t::iterator id = transmap_.find(key);
if (id == transmap_.end()) // No if (id == transmap_.end()) // No
{ {
mapit_t pos = transmap_ mapit_t pos =
.insert(std::make_pair(key, it->current_condition())).first; transmap_.emplace(key, it->current_condition()).first;
// Keep the order of the transitions in the // Keep the order of the transitions in the
// degeneralized automaton related to the order of the // degeneralized automaton related to the order of the
// transitions in the input automaton: in the past we // transitions in the input automaton: in the past we

View file

@ -66,8 +66,7 @@ namespace spot
enumerate_cycles::tagged_state enumerate_cycles::tagged_state
enumerate_cycles::tag_state(const state* s) enumerate_cycles::tag_state(const state* s)
{ {
std::pair<tagged_state, bool> p = auto p = tags_.emplace(s, state_info());
tags_.insert(std::make_pair(s, state_info()));
if (!p.second) if (!p.second)
s->destroy(); s->destroy();
return p.first; return p.first;

View file

@ -103,7 +103,7 @@ namespace spot
union_ |= set; union_ |= set;
} }
cache_entry e(common, union_); 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 // Intersection of all outgoing acceptance sets
@ -144,8 +144,7 @@ namespace spot
bool check(const state* s) bool check(const state* s)
{ {
std::pair<cache_t::iterator, bool> p = auto p = cache_.emplace(s, false);
cache_.insert(std::make_pair(s, false));
if (p.second) if (p.second)
{ {
bdd all = a_->all_acceptance_conditions(); bdd all = a_->all_acceptance_conditions();
@ -569,9 +568,7 @@ namespace spot
if (use_lvl_cache) if (use_lvl_cache)
{ {
std::pair<lvl_cache_t::iterator, bool> res = auto res = lvl_cache.emplace(d.first, d.second);
lvl_cache.insert(lvl_cache_t::value_type(d.first,
d.second));
if (!res.second) if (!res.second)
{ {

View file

@ -312,10 +312,10 @@ namespace spot
transition t(i, one, j); transition t(i, one, j);
d.transid[t] = ++d.nvars; 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] = int ta = d.transacc[t] =
state_based_ ? transacc : ++d.nvars; state_based_ ? transacc : ++d.nvars;
d.revtransacc.insert(dict::rev_map::value_type(ta, t)); d.revtransacc.emplace(ta, t);
} }
} }
} }

View file

@ -411,8 +411,7 @@ namespace spot
transition t(i, one, j); transition t(i, one, j);
d.transid[t] = ++d.nvars; d.transid[t] = ++d.nvars;
d.revtransid.insert(dict::rev_map:: d.revtransid.emplace(d.nvars, t);
value_type(d.nvars, t));
// Create the variable for the accepting transition // Create the variable for the accepting transition
// immediately afterwards. It helps parsing the // immediately afterwards. It helps parsing the
@ -421,8 +420,7 @@ namespace spot
{ {
transition_acc ta(i, one, d.cand_acc[n], j); transition_acc ta(i, one, d.cand_acc[n], j);
d.transaccid[ta] = ++d.nvars; d.transaccid[ta] = ++d.nvars;
d.revtransaccid.insert(dict::rev_acc_map:: d.revtransaccid.emplace(d.nvars, ta);
value_type(d.nvars, ta));
} }
} }
} }
@ -443,8 +441,7 @@ namespace spot
transition_acc ta(i, one, d.cand_acc[n], j); transition_acc ta(i, one, d.cand_acc[n], j);
d.transaccid[ta] = d.nvars; d.transaccid[ta] = d.nvars;
d.revtransaccid.insert(dict::rev_acc_map:: d.revtransaccid.emplace(d.nvars, ta);
value_type(d.nvars, ta));
} }
} }
} }
@ -459,8 +456,7 @@ namespace spot
transition t(i, one, j); transition t(i, one, j);
d.transid[t] = ++d.nvars; d.transid[t] = ++d.nvars;
d.revtransid.insert(dict::rev_map:: d.revtransid.emplace(d.nvars, t);
value_type(d.nvars, t));
} }
} }
} }

View file

@ -308,7 +308,7 @@ namespace spot
assert(s->compare(i->s) == 0); assert(s->compare(i->s) == 0);
src = res->new_state(); src = res->new_state();
seen.insert(std::make_pair(i->s, src)); seen.emplace(i->s, src);
for (; i != l->end();) for (; i != l->end();)
{ {
@ -355,7 +355,7 @@ namespace spot
s = the_next; s = the_next;
auto p = seen.insert(std::make_pair(next, 0)); auto p = seen.emplace(next, 0);
if (p.second) if (p.second)
p.first->second = res->new_state(); p.first->second = res->new_state();
dst = p.first->second; dst = p.first->second;

View file

@ -215,7 +215,7 @@ namespace spot
// We do not need SUCC from now on. // We do not need SUCC from now on.
// Are we going to a new state? // 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) if (p.second)
{ {
// Yes. Bump number, stack the stack, and register its // Yes. Bump number, stack the stack, and register its

View file

@ -1749,7 +1749,7 @@ namespace spot
} }
f->clone(); 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()) if (b2f_.find(t.symbolic) == b2f_.end())
b2f_[t.symbolic] = f; 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* const formula*

View file

@ -484,7 +484,7 @@ namespace spot
void add_new_state(const state* s, color c) void add_new_state(const state* s, color c)
{ {
assert(h.find(s) == h.end()); assert(h.find(s) == h.end());
h.insert(std::make_pair(s, c)); h.emplace(s, c);
} }
void pop_notify(const state*) const void pop_notify(const state*) const

View file

@ -557,7 +557,7 @@ namespace spot
{ {
ndfsr_trace << a_->format_state(i->source) << " (-> " ndfsr_trace << a_->format_state(i->source) << " (-> "
<< a_->format_state(i->dest) << ") "; << a_->format_state(i->dest) << ") ";
target.insert(std::make_pair(i->source, *i)); target.emplace(i->source, *i);
} }
} }
ndfsr_trace << std::endl; ndfsr_trace << std::endl;
@ -605,7 +605,7 @@ namespace spot
<< a_->format_state(begin) << std::endl; << a_->format_state(begin) << std::endl;
transition tmp; transition tmp;
tmp.source = tmp.dest = 0; // Initialize to please GCC 4.0.1 (Darwin). 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_); min_path<true> s(this, a_, target, h_);
const state* res = s.search(current.dest->clone(), run->cycle); const state* res = s.search(current.dest->clone(), run->cycle);
assert(res); assert(res);
@ -623,7 +623,7 @@ namespace spot
// Register all states from the cycle as target of the BFS. // Register all states from the cycle as target of the BFS.
for (tgba_run::steps::const_iterator i = run->cycle.begin(); for (tgba_run::steps::const_iterator i = run->cycle.begin();
i != run->cycle.end(); ++i) 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(); const state* prefix_start = a_->get_init_state();
// There are two cases: either the initial state is already on // There are two cases: either the initial state is already on

View file

@ -203,8 +203,7 @@ namespace spot
} }
dst = si->current_state(); dst = si->current_state();
std::pair<seen_map::iterator, bool> res = auto res = seen.emplace(dst, n);
seen.insert(std::make_pair(dst, n));
if (!res.second) if (!res.second)
{ {
// The state has already been seen. // The state has already been seen.

View file

@ -146,7 +146,7 @@ namespace spot
self_loops_ = 0; self_loops_ = 0;
state* init = aut_->get_init_state(); state* init = aut_->get_init_state();
num_ = -1; num_ = -1;
h_.insert(std::make_pair(init, num_)); h_.emplace(init, num_);
root_.emplace_front(num_); root_.emplace_front(num_);
arc_acc_.push(bddfalse); arc_acc_.push(bddfalse);
arc_cond_.push(bddfalse); arc_cond_.push(bddfalse);
@ -196,7 +196,7 @@ namespace spot
// Record the transition between the SCC being popped // Record the transition between the SCC being popped
// and the previous SCC. // and the previous SCC.
if (!root_.empty()) if (!root_.empty())
root_.front().succ.insert(std::make_pair(num, cond)); root_.front().succ.emplace(num, cond);
} }
aut_->release_iter(succ); aut_->release_iter(succ);
@ -223,7 +223,7 @@ namespace spot
{ {
// Yes. Number it, stack it, and register its successors // Yes. Number it, stack it, and register its successors
// for later processing. // for later processing.
h_.insert(std::make_pair(dest, --num_)); h_.emplace(dest, --num_);
root_.emplace_front(num_); root_.emplace_front(num_);
arc_acc_.push(acc); arc_acc_.push(acc);
arc_cond_.push(cond); arc_cond_.push(cond);
@ -244,7 +244,7 @@ namespace spot
// dest SCC labelled with cond. // dest SCC labelled with cond.
succ_type::iterator i = root_.front().succ.find(dest); succ_type::iterator i = root_.front().succ.find(dest);
if (i == root_.front().succ.end()) if (i == root_.front().succ.end())
root_.front().succ.insert(std::make_pair(dest, cond)); root_.front().succ.emplace(dest, cond);
else else
i->second |= cond; i->second |= cond;

View file

@ -466,7 +466,7 @@ namespace spot
// turn makes sure we preserve the acceptance condition // turn makes sure we preserve the acceptance condition
// ordering (which matters for degeneralization). // ordering (which matters for degeneralization).
for (BDD c = useful.id(); c != 1; c = bdd_low(c)) 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; max_table[n] = max_num;
} }
@ -854,7 +854,7 @@ namespace spot
// turn makes sure we preserve the acceptance condition // turn makes sure we preserve the acceptance condition
// ordering (which matters for degeneralization). // ordering (which matters for degeneralization).
for (BDD c = useful.id(); c != 1; c = bdd_low(c)) 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; max_table[n] = max_num;
} }

View file

@ -470,7 +470,7 @@ namespace spot
int i = phc->erase(ps); int i = phc->erase(ps);
assert(i == 1); assert(i == 1);
(void)i; (void)i;
ph->insert(std::make_pair(ps, c)); ph->emplace(ps, c);
} }
else else
{ {
@ -540,7 +540,7 @@ namespace spot
if (c == CYAN) if (c == CYAN)
hc.insert(s); hc.insert(s);
else else
h.insert(std::make_pair(s, c)); h.emplace(s, c);
} }
void pop_notify(const state*) const void pop_notify(const state*) const

View file

@ -141,9 +141,9 @@ namespace spot
map_constraint& feed_me) map_constraint& feed_me)
{ {
for (auto& p: list) for (auto& p: list)
feed_me.insert(std::make_pair(std::make_pair(std::get<0>(p), feed_me.emplace(std::make_pair(std::get<0>(p),
std::get<1>(p)), std::get<1>(p)),
std::get<2>(p))); std::get<2>(p));
} }

View file

@ -347,7 +347,7 @@ namespace spot
void add_new_state(const state* s, color c) void add_new_state(const state* s, color c)
{ {
assert(h.find(s) == h.end()); 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 void pop_notify(const state*) const

View file

@ -445,7 +445,7 @@ namespace spot
{ {
assert(c != CYAN); assert(c != CYAN);
std::pair<hash_type::iterator, bool> p; 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); assert(p.second);
acc = &(p.first->second.second); acc = &(p.first->second.second);
int i = phc->erase(ps); int i = phc->erase(ps);
@ -536,7 +536,9 @@ namespace spot
assert(hc.find(s) == hc.end() && h.find(s) == h.end()); assert(hc.find(s) == hc.end() && h.find(s) == h.end());
assert(c == CYAN); assert(c == CYAN);
(void)c; (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 void pop_notify(const state*) const

View file

@ -39,7 +39,7 @@ namespace spot
{ {
weight::weight_vector::iterator it = pm->find(v); weight::weight_vector::iterator it = pm->find(v);
if (it == pm->end()) if (it == pm->end())
pm->insert(std::make_pair(v, 1)); pm->emplace(v, 1);
else else
++(it->second); ++(it->second);
break; break;