From 43ec36cda7561097e88d5eb8555fcbcfd6288fc5 Mon Sep 17 00:00:00 2001 From: Etienne Renault Date: Tue, 22 Nov 2016 10:21:08 +0100 Subject: [PATCH] Prefer emplace_back to push_back * spot/graph/ngraph.hh, spot/ltsmin/ltsmin.cc, spot/misc/bitvect.hh, spot/misc/intvcomp.cc, spot/misc/satsolver.cc, spot/priv/weight.cc, spot/ta/taexplicit.cc, spot/taalgos/minimize.cc, spot/taalgos/reachiter.cc, spot/tl/exclusive.cc, spot/tl/formula.cc, spot/tl/formula.hh, spot/tl/mark.cc, spot/tl/mutation.cc, spot/tl/relabel.cc, spot/tl/remove_x.cc, spot/tl/simplify.cc, spot/twa/acc.cc, spot/twa/acc.hh, spot/twa/formula2bdd.cc, spot/twa/taatgba.cc, spot/twa/taatgba.hh, spot/twa/twa.hh, spot/twa/twagraph.cc, spot/twaalgos/bfssteps.cc, spot/twaalgos/canonicalize.cc, spot/twaalgos/compsusp.cc, spot/twaalgos/copy.cc, spot/twaalgos/cycles.cc, spot/twaalgos/degen.cc, spot/twaalgos/determinize.cc, spot/twaalgos/dtwasat.cc, spot/twaalgos/emptiness.cc, spot/twaalgos/gv04.cc, spot/twaalgos/hoa.cc, spot/twaalgos/ltl2taa.cc, spot/twaalgos/ltl2tgba_fm.cc, spot/twaalgos/magic.cc, spot/twaalgos/mask.hh, spot/twaalgos/minimize.cc, spot/twaalgos/powerset.cc, spot/twaalgos/product.cc, spot/twaalgos/randomgraph.cc, spot/twaalgos/reachiter.cc, spot/twaalgos/relabel.cc, spot/twaalgos/remfin.cc, spot/twaalgos/sccfilter.cc, spot/twaalgos/se05.cc, spot/twaalgos/simulation.cc, spot/twaalgos/stutter.cc, spot/twaalgos/tau03opt.cc, spot/twaalgos/totgba.cc, spot/twaalgos/word.cc, tests/core/bitvect.cc: here. --- spot/graph/ngraph.hh | 4 +- spot/ltsmin/ltsmin.cc | 14 +-- spot/misc/bitvect.hh | 12 +-- spot/misc/intvcomp.cc | 8 +- spot/misc/satsolver.cc | 2 +- spot/priv/weight.cc | 2 +- spot/ta/taexplicit.cc | 4 +- spot/taalgos/minimize.cc | 24 ++--- spot/taalgos/reachiter.cc | 2 +- spot/tl/exclusive.cc | 8 +- spot/tl/formula.cc | 12 +-- spot/tl/formula.hh | 6 +- spot/tl/mark.cc | 14 +-- spot/tl/mutation.cc | 6 +- spot/tl/relabel.cc | 12 +-- spot/tl/remove_x.cc | 22 ++--- spot/tl/simplify.cc | 160 +++++++++++++++++----------------- spot/twa/acc.cc | 30 +++---- spot/twa/acc.hh | 6 +- spot/twa/formula2bdd.cc | 2 +- spot/twa/taatgba.cc | 8 +- spot/twa/taatgba.hh | 6 +- spot/twa/twa.hh | 4 +- spot/twa/twagraph.cc | 2 +- spot/twaalgos/bfssteps.cc | 4 +- spot/twaalgos/canonicalize.cc | 2 +- spot/twaalgos/compsusp.cc | 16 ++-- spot/twaalgos/copy.cc | 4 +- spot/twaalgos/cycles.cc | 6 +- spot/twaalgos/degen.cc | 8 +- spot/twaalgos/determinize.cc | 14 +-- spot/twaalgos/dtwasat.cc | 12 +-- spot/twaalgos/emptiness.cc | 6 +- spot/twaalgos/gv04.cc | 2 +- spot/twaalgos/hoa.cc | 2 +- spot/twaalgos/ltl2taa.cc | 42 ++++----- spot/twaalgos/ltl2tgba_fm.cc | 22 ++--- spot/twaalgos/magic.cc | 6 +- spot/twaalgos/mask.hh | 2 +- spot/twaalgos/minimize.cc | 14 +-- spot/twaalgos/powerset.cc | 8 +- spot/twaalgos/product.cc | 2 +- spot/twaalgos/randomgraph.cc | 4 +- spot/twaalgos/reachiter.cc | 4 +- spot/twaalgos/relabel.cc | 2 +- spot/twaalgos/remfin.cc | 8 +- spot/twaalgos/sccfilter.cc | 4 +- spot/twaalgos/se05.cc | 6 +- spot/twaalgos/simulation.cc | 8 +- spot/twaalgos/stutter.cc | 16 ++-- spot/twaalgos/tau03opt.cc | 2 +- spot/twaalgos/totgba.cc | 8 +- spot/twaalgos/word.cc | 8 +- tests/core/bitvect.cc | 8 +- 54 files changed, 310 insertions(+), 310 deletions(-) diff --git a/spot/graph/ngraph.hh b/spot/graph/ngraph.hh index 822cfb424..e579ecce1 100644 --- a/spot/graph/ngraph.hh +++ b/spot/graph/ngraph.hh @@ -144,7 +144,7 @@ namespace spot std::vector d; d.reserve(dst.size()); for (auto n: dst) - d.push_back(get_state(n)); + d.emplace_back(get_state(n)); return g_.new_edge(get_state(src), d, std::forward(args)...); } @@ -156,7 +156,7 @@ namespace spot std::vector d; d.reserve(dst.size()); for (auto n: dst) - d.push_back(get_state(n)); + d.emplace_back(get_state(n)); return g_.new_edge(get_state(src), d, std::forward(args)...); } }; diff --git a/spot/ltsmin/ltsmin.cc b/spot/ltsmin/ltsmin.cc index b70d262c3..d90a7b8d1 100644 --- a/spot/ltsmin/ltsmin.cc +++ b/spot/ltsmin/ltsmin.cc @@ -236,7 +236,7 @@ namespace spot new(p->allocate()) spins_state(ctx->state_size, p); memcpy(out->vars, dst, ctx->state_size * sizeof(int)); out->compute_hash(); - ctx->transitions.push_back(out); + ctx->transitions.emplace_back(out); } void transition_callback_compress(void* arg, transition_info_t*, int *dst) @@ -252,7 +252,7 @@ namespace spot spins_compressed_state* out = new(mem) spins_compressed_state(csize, p); memcpy(out->vars, ctx->compressed, csize * sizeof(int)); out->compute_hash(); - ctx->transitions.push_back(out); + ctx->transitions.emplace_back(out); } //////////////////////////////////////////////////////////////////////// @@ -462,7 +462,7 @@ namespace spot // Record that X.Y must be equal to Z. int v = dict->register_proposition(*ap, d.get()); one_prop p = { ni->second.num, OP_EQ, ei->second, v }; - out.push_back(p); + out.emplace_back(p); free(name); continue; } @@ -473,7 +473,7 @@ namespace spot { int v = dict->register_proposition(*ap, d); one_prop p = { var_num, OP_NE, 0, v }; - out.push_back(p); + out.emplace_back(p); free(name); continue; } @@ -591,7 +591,7 @@ namespace spot int v = dict->register_proposition(*ap, d); one_prop p = { var_num, op, val, v }; - out.push_back(p); + out.emplace_back(p); } if (errors) @@ -809,7 +809,7 @@ namespace spot // Add a self-loop to dead-states if we care about these. if (res != bddfalse) - cc->transitions.push_back(st->clone()); + cc->transitions.emplace_back(st->clone()); } state_condition_last_cc_ = cc; @@ -861,7 +861,7 @@ namespace spot // Add a self-loop to dead-states if we care about these. if (t == 0 && scond != bddfalse) - cc->transitions.push_back(st->clone()); + cc->transitions.emplace_back(st->clone()); } if (iter_cache_) diff --git a/spot/misc/bitvect.hh b/spot/misc/bitvect.hh index 20bba37c7..932e87f21 100644 --- a/spot/misc/bitvect.hh +++ b/spot/misc/bitvect.hh @@ -141,7 +141,7 @@ namespace spot } /// Append one bit. - void push_back(bool val) + void emplace_back(bool val) { if (size() == capacity()) grow(); @@ -153,7 +153,7 @@ namespace spot } /// \brief Append the lowest \a count bits of \a data. - void push_back(block_t data, unsigned count) + void emplace_back(block_t data, unsigned count) { if (size() + count > capacity()) grow(); @@ -417,18 +417,18 @@ namespace spot { block_t data = storage_[indexb]; data >>= bitb; - res->push_back(data, count); + res->emplace_back(data, count); } else { block_t data = storage_[indexb]; data >>= bitb; - res->push_back(data, bpb - bitb); + res->emplace_back(data, bpb - bitb); count -= bpb - bitb; while (count >= bpb) { ++indexb; - res->push_back(storage_[indexb], bpb); + res->emplace_back(storage_[indexb], bpb); count -= bpb; SPOT_ASSERT(indexb != indexe || count == 0); } @@ -437,7 +437,7 @@ namespace spot ++indexb; SPOT_ASSERT(indexb == indexe); SPOT_ASSERT(count == end % bpb); - res->push_back(storage_[indexb], count); + res->emplace_back(storage_[indexb], count); } } return res; diff --git a/spot/misc/intvcomp.cc b/spot/misc/intvcomp.cc index cf2486455..65059f040 100644 --- a/spot/misc/intvcomp.cc +++ b/spot/misc/intvcomp.cc @@ -196,7 +196,7 @@ namespace spot void push_data(unsigned int i) { - result_->push_back(i); + result_->emplace_back(i); } const std::vector* @@ -246,7 +246,7 @@ namespace spot void push_data(unsigned int i) { - output_.push_back(i); + output_.emplace_back(i); } bool have_data() const @@ -543,7 +543,7 @@ namespace spot void push_data(int i) { prev_ = i; - result_.push_back(i); + result_.emplace_back(i); --size_; } @@ -551,7 +551,7 @@ namespace spot { size_ -= i; while (i--) - result_.push_back(prev_); + result_.emplace_back(prev_); } bool have_comp_data() const diff --git a/spot/misc/satsolver.cc b/spot/misc/satsolver.cc index 7c196b241..f02d5ca8f 100644 --- a/spot/misc/satsolver.cc +++ b/spot/misc/satsolver.cc @@ -108,7 +108,7 @@ namespace spot { if (i == 0) goto done; - sol.push_back(i); + sol.emplace_back(i); } if (!in->eof()) // If we haven't reached end-of-file, then we just attempted diff --git a/spot/priv/weight.cc b/spot/priv/weight.cc index c1cc6420e..0057b48f6 100644 --- a/spot/priv/weight.cc +++ b/spot/priv/weight.cc @@ -52,7 +52,7 @@ namespace spot std::vector res; for (unsigned n = 0; n < max; ++n) if (m[n] > w.m[n]) - res.push_back(n); + res.emplace_back(n); return acc_cond::mark_t(res.begin(), res.end()); } diff --git a/spot/ta/taexplicit.cc b/spot/ta/taexplicit.cc index 393d6fc26..400f8f140 100644 --- a/spot/ta/taexplicit.cc +++ b/spot/ta/taexplicit.cc @@ -158,8 +158,8 @@ namespace spot } else { - trans_by_condition->push_back(t); - transitions_->push_back(t); + trans_by_condition->emplace_back(t); + transitions_->emplace_back(t); } } diff --git a/spot/taalgos/minimize.cc b/spot/taalgos/minimize.cc index fee3fffd7..bea3fd2e6 100644 --- a/spot/taalgos/minimize.cc +++ b/spot/taalgos/minimize.cc @@ -266,7 +266,7 @@ namespace spot { hash_set* cI = new hash_set; cI->insert(*i); - done.push_back(cI); + done.emplace_back(cI); used_var[set_num] = 1; free_var.erase(set_num); @@ -284,9 +284,9 @@ namespace spot used_var[num] = s; free_var.erase(num); if (s > 1) - cur_run.push_back(G); + cur_run.emplace_back(G); else - done.push_back(G); + done.emplace_back(G); for (hash_set::const_iterator i = G->begin(); i != G->end(); ++i) state_set_map[*i] = num; @@ -304,9 +304,9 @@ namespace spot used_var[num] = s; free_var.erase(num); if (s > 1) - cur_run.push_back(F); + cur_run.emplace_back(F); else - done.push_back(F); + done.emplace_back(F); for (hash_set::const_iterator i = F->begin(); i != F->end(); ++i) state_set_map[*i] = num; } @@ -323,9 +323,9 @@ namespace spot used_var[num] = s; free_var.erase(num); if (s > 1) - cur_run.push_back(G_F); + cur_run.emplace_back(G_F); else - done.push_back(G_F); + done.emplace_back(G_F); for (hash_set::const_iterator i = G_F->begin(); i != G_F->end(); ++i) state_set_map[*i] = num; } @@ -342,9 +342,9 @@ namespace spot used_var[num] = s; free_var.erase(num); if (s > 1) - cur_run.push_back(S); + cur_run.emplace_back(S); else - done.push_back(S); + done.emplace_back(S); for (hash_set::const_iterator i = S->begin(); i != S->end(); ++i) state_set_map[*i] = num; } @@ -432,7 +432,7 @@ namespace spot trace << "set " << format_hash_set(bsi->second, ta_) << " was not split" << std::endl; - next_run.push_back(bsi->second); + next_run.emplace_back(bsi->second); } else { @@ -466,14 +466,14 @@ namespace spot trace << "set " << format_hash_set(set, ta_) << " is minimal" << std::endl; - done.push_back(set); + done.emplace_back(set); } else { trace << "set " << format_hash_set(set, ta_) << " should be processed further" << std::endl; - next_run.push_back(set); + next_run.emplace_back(set); } } } diff --git a/spot/taalgos/reachiter.cc b/spot/taalgos/reachiter.cc index f7833fb4c..f60e504dd 100644 --- a/spot/taalgos/reachiter.cc +++ b/spot/taalgos/reachiter.cc @@ -167,7 +167,7 @@ namespace spot void ta_reachable_iterator_breadth_first::add_state(const state* s) { - todo.push_back(s); + todo.emplace_back(s); } const state* diff --git a/spot/tl/exclusive.cc b/spot/tl/exclusive.cc index cb32b86f6..657d1365f 100644 --- a/spot/tl/exclusive.cc +++ b/spot/tl/exclusive.cc @@ -104,7 +104,7 @@ namespace spot void exclusive_ap::add_group(std::vector ap) { - groups.push_back(ap); + groups.emplace_back(ap); } namespace @@ -130,12 +130,12 @@ namespace spot for (auto ap: g) if (s->find(ap) != s->end()) - group.push_back(ap); + group.emplace_back(ap); unsigned s = group.size(); for (unsigned j = 0; j < s; ++j) for (unsigned k = j + 1; k < s; ++k) - v.push_back(nand(group[j], group[k])); + v.emplace_back(nand(group[j], group[k])); }; delete s; @@ -166,7 +166,7 @@ namespace spot { int v = d->has_registered_proposition(ap, aut); if (v >= 0) - group.push_back(bdd_nithvar(v)); + group.emplace_back(bdd_nithvar(v)); } unsigned s = group.size(); diff --git a/spot/tl/formula.cc b/spot/tl/formula.cc index a94246c38..5f04f0c32 100644 --- a/spot/tl/formula.cc +++ b/spot/tl/formula.cc @@ -105,7 +105,7 @@ namespace spot { if ((*i)->is_boolean()) { - b.push_back(*i); + b.emplace_back(*i); i = v.erase(i); } else @@ -230,7 +230,7 @@ namespace spot { unsigned ps = (*i)->size(); for (unsigned n = 0; n < ps; ++n) - inlined.push_back((*i)->nth(n)->clone()); + inlined.emplace_back((*i)->nth(n)->clone()); (*i)->destroy(); // FIXME: Do not use erase. See previous FIXME. i = v.erase(i); @@ -242,7 +242,7 @@ namespace spot // For concat we have to keep track of the order of // all the arguments. if (o == op::Concat || o == op::Fusion) - inlined.push_back(*i); + inlined.emplace_back(*i); ++i; } if (o == op::Concat || o == op::Fusion) @@ -470,10 +470,10 @@ namespace spot i->destroy(); continue; } - tmp.push_back(i); + tmp.emplace_back(i); } if (tmp.empty()) - tmp.push_back(weak_abs); + tmp.emplace_back(weak_abs); v.swap(tmp); } } @@ -1624,7 +1624,7 @@ namespace spot v.reserve(s - 1); for (unsigned j = 0; j < s; ++j) if (i != j) - v.push_back(nth(j)->clone()); + v.emplace_back(nth(j)->clone()); return multop(o, v); } default: diff --git a/spot/tl/formula.hh b/spot/tl/formula.hh index 398fbb6ca..c807ad6d7 100644 --- a/spot/tl/formula.hh +++ b/spot/tl/formula.hh @@ -1018,7 +1018,7 @@ namespace spot tmp.reserve(l.size()); for (auto f: l) if (f.ptr_) - tmp.push_back(f.ptr_->clone()); + tmp.emplace_back(f.ptr_->clone()); return formula(fnode::multop(o, std::move(tmp))); } @@ -1029,7 +1029,7 @@ namespace spot tmp.reserve(l.size()); for (auto f: l) if (f.ptr_) - tmp.push_back(f.to_node_()); + tmp.emplace_back(f.to_node_()); return formula(fnode::multop(o, std::move(tmp))); } #endif // !SWIG @@ -1628,7 +1628,7 @@ namespace spot std::vector tmp; tmp.reserve(size()); for (auto f: *this) - tmp.push_back(trans(f)); + tmp.emplace_back(trans(f)); return multop(o, std::move(tmp)); } case op::Star: diff --git a/spot/tl/mark.cc b/spot/tl/mark.cc index fbc2d6495..b6e83ccca 100644 --- a/spot/tl/mark.cc +++ b/spot/tl/mark.cc @@ -137,24 +137,24 @@ namespace spot if (c.is(op::EConcatMarked)) { empairs.emplace(c[0], c[1]); - v.push_back(c.map(recurse)); + v.emplace_back(c.map(recurse)); } else if (c.is(op::EConcat)) { - elist.push_back(c); + elist.emplace_back(c); } else if (c.is(op::NegClosureMarked)) { nmset.insert(c[0]); - v.push_back(c.map(recurse)); + v.emplace_back(c.map(recurse)); } else if (c.is(op::NegClosure)) { - nlist.push_back(c); + nlist.emplace_back(c); } else { - v.push_back(c); + v.emplace_back(c); } } // Keep only the non-marked EConcat for which we @@ -162,12 +162,12 @@ namespace spot for (auto e: elist) if (empairs.find(std::make_pair(e[0], e[1])) == empairs.end()) - v.push_back(e); + v.emplace_back(e); // Keep only the non-marked NegClosure for which we // have not seen a similar NegClosureMarked. for (auto n: nlist) if (nmset.find(n[0]) == nmset.end()) - v.push_back(n); + v.emplace_back(n); res = formula::And(v); } break; diff --git a/spot/tl/mutation.cc b/spot/tl/mutation.cc index 2c04dd510..6bee8e1e8 100644 --- a/spot/tl/mutation.cc +++ b/spot/tl/mutation.cc @@ -116,7 +116,7 @@ namespace spot { vec v1; vec v2; - v1.push_back(f[0]); + v1.emplace_back(f[0]); bool reverse = false; int i = 1; while (i < mos) @@ -128,10 +128,10 @@ namespace spot reverse = true; break; } - v1.push_back(f[i++]); + v1.emplace_back(f[i++]); } for (; i < mos; ++i) - v2.push_back(f[i]); + v2.emplace_back(f[i]); formula first = AndNLM_(v1); formula second = AndNLM_(v2); formula ost = formula::one_star(); diff --git a/spot/tl/relabel.cc b/spot/tl/relabel.cc index 90e2a6f0a..838fe19c5 100644 --- a/spot/tl/relabel.cc +++ b/spot/tl/relabel.cc @@ -253,8 +253,8 @@ namespace spot if (!s.empty()) { formula top = s.top(); - in.first->second.push_back(top); - g[top].push_back(f); + in.first->second.emplace_back(top); + g[top].emplace_back(f); if (!in.second) return; } @@ -291,10 +291,10 @@ namespace spot // Note that we only add an edge in one // direction, because we are building a cycle // between all children anyway. - g[pred].push_back(next); + g[pred].emplace_back(next); pred = next; } - g[pred].push_back(f[0]); + g[pred].emplace_back(f[0]); } s.pop(); } @@ -436,7 +436,7 @@ namespace spot if (b && b != f) { res.reserve(sz - i + 1); - res.push_back(visit(b)); + res.emplace_back(visit(b)); } else { @@ -444,7 +444,7 @@ namespace spot res.reserve(sz); } for (; i < sz; ++i) - res.push_back(visit(f[i])); + res.emplace_back(visit(f[i])); return formula::multop(f.kind(), res); } }; diff --git a/spot/tl/remove_x.cc b/spot/tl/remove_x.cc index b1ea493ee..582036103 100644 --- a/spot/tl/remove_x.cc +++ b/spot/tl/remove_x.cc @@ -47,8 +47,8 @@ namespace spot // First line std::vector va1; formula npi = formula::Not(i); - va1.push_back(i); - va1.push_back(formula::U(i, formula::And({npi, c}))); + va1.emplace_back(i); + va1.emplace_back(formula::U(i, formula::And({npi, c}))); for (auto j: aps) if (j != i) @@ -56,22 +56,22 @@ namespace spot // make sure the arguments of OR are created in a // deterministic order auto tmp = formula::U(formula::Not(j), npi); - va1.push_back(formula::Or({formula::U(j, npi), tmp})); + va1.emplace_back(formula::Or({formula::U(j, npi), tmp})); } - vo.push_back(formula::And(va1)); + vo.emplace_back(formula::And(va1)); // Second line std::vector va2; - va2.push_back(npi); - va2.push_back(formula::U(npi, formula::And({i, c}))); + va2.emplace_back(npi); + va2.emplace_back(formula::U(npi, formula::And({i, c}))); for (auto j: aps) if (j != i) { // make sure the arguments of OR are created in a // deterministic order auto tmp = formula::U(formula::Not(j), i); - va2.push_back(formula::Or({formula::U(j, i), tmp})); + va2.emplace_back(formula::Or({formula::U(j, i), tmp})); } - vo.push_back(formula::And(va2)); + vo.emplace_back(formula::And(va2)); } // Third line std::vector va3; @@ -80,10 +80,10 @@ namespace spot // make sure the arguments of OR are created in a // deterministic order auto tmp = formula::G(formula::Not(i)); - va3.push_back(formula::Or({formula::G(i), tmp})); + va3.emplace_back(formula::Or({formula::G(i), tmp})); } - va3.push_back(c); - vo.push_back(formula::And(va3)); + va3.emplace_back(c); + vo.emplace_back(formula::And(va3)); return formula::Or(vo); } } diff --git a/spot/tl/simplify.cc b/spot/tl/simplify.cc index e96b0ac54..af5b2e225 100644 --- a/spot/tl/simplify.cc +++ b/spot/tl/simplify.cc @@ -482,7 +482,7 @@ namespace spot unsigned mos = f.size(); vec v; for (unsigned i = 0; i < mos; ++i) - v.push_back(rec(f[i], negated)); + v.emplace_back(rec(f[i], negated)); op on = o; if (negated) on = o == op::Or ? op::And : op::Or; @@ -704,7 +704,7 @@ namespace spot case op::X: if (res_X && !eu) { - res_X->push_back(f[0]); + res_X->emplace_back(f[0]); return; } break; @@ -713,13 +713,13 @@ namespace spot formula c = f[0]; if (res_FG && u && c.is(op::G)) { - res_FG->push_back(((split_ & Strip_FG) == Strip_FG + res_FG->emplace_back(((split_ & Strip_FG) == Strip_FG ? c[0] : f)); return; } if (res_F && !eu) { - res_F->push_back(((split_ & Strip_F) == Strip_F + res_F->emplace_back(((split_ & Strip_F) == Strip_F ? c : f)); return; } @@ -730,13 +730,13 @@ namespace spot formula c = f[0]; if (res_GF && e && c.is(op::F)) { - res_GF->push_back(((split_ & Strip_GF) == Strip_GF + res_GF->emplace_back(((split_ & Strip_GF) == Strip_GF ? c[0] : f)); return; } if (res_G && !eu) { - res_G->push_back(((split_ & Strip_G) == Strip_G + res_G->emplace_back(((split_ & Strip_G) == Strip_G ? c : f)); return; } @@ -746,7 +746,7 @@ namespace spot case op::W: if (res_U_or_W) { - res_U_or_W->push_back(f); + res_U_or_W->emplace_back(f); return; } break; @@ -754,14 +754,14 @@ namespace spot case op::M: if (res_R_or_M) { - res_R_or_M->push_back(f); + res_R_or_M->emplace_back(f); return; } break; default: if (res_Bool && f.is_boolean()) { - res_Bool->push_back(f); + res_Bool->emplace_back(f); return; } break; @@ -770,21 +770,21 @@ namespace spot { if (res_EventUniv && e && u) { - res_EventUniv->push_back(f); + res_EventUniv->emplace_back(f); return; } if (res_Event && e) { - res_Event->push_back(f); + res_Event->emplace_back(f); return; } if (res_Univ && u) { - res_Univ->push_back(f); + res_Univ->emplace_back(f); return; } } - res_other->push_back(f); + res_other->emplace_back(f); } unsigned split_; @@ -892,7 +892,7 @@ namespace spot mospliter s(mospliter::Split_EventUniv, c, c_); op oc = c.kind(); s.res_EventUniv-> - push_back(unop_multop(op::X, oc, + emplace_back(unop_multop(op::X, oc, std::move(*s.res_other))); formula result = formula::multop(oc, @@ -984,10 +984,10 @@ namespace spot mospliter::Split_EventUniv, c, c_); s.res_EventUniv-> - push_back(unop_multop(op::F, op::And, + emplace_back(unop_multop(op::F, op::And, std::move(*s.res_other))); s.res_EventUniv-> - push_back(unop_unop_multop(op::F, op::G, op::And, + emplace_back(unop_unop_multop(op::F, op::G, op::And, std::move(*s.res_FG))); formula res = formula::And(std::move(*s.res_EventUniv)); @@ -1059,10 +1059,10 @@ namespace spot mospliter::Split_EventUniv, c, c_); s.res_EventUniv-> - push_back(unop_multop(op::G, op::Or, + emplace_back(unop_multop(op::G, op::Or, std::move(*s.res_other))); s.res_EventUniv-> - push_back(unop_unop_multop(op::G, op::F, op::Or, + emplace_back(unop_unop_multop(op::G, op::F, op::Or, std::move(*s.res_GF))); formula res = formula::Or(std::move(*s.res_EventUniv)); @@ -1126,7 +1126,7 @@ namespace spot mospliter s(mospliter::Split_EventUniv, c[0], c_); s.res_EventUniv-> - push_back(unop_multop(op::F, op::And, + emplace_back(unop_multop(op::F, op::And, std::move(*s.res_other))); formula res = formula::G(formula::And(std::move(*s.res_EventUniv))); @@ -1158,7 +1158,7 @@ namespace spot unsigned s = c.size(); vec v; for (unsigned n = 0; n < s; ++n) - v.push_back(formula::unop(o, c[n])); + v.emplace_back(formula::unop(o, c[n])); return recurse(formula::multop(o == op::Closure ? op::Or : op::And, v)); } @@ -1175,7 +1175,7 @@ namespace spot unsigned end = c.size(); v.reserve(end); for (unsigned i = 0; i < end; ++i) - v.push_back(formula::unop(o, c[i])); + v.emplace_back(formula::unop(o, c[i])); return recurse(formula::multop(o == op::Closure ? op::Or : op::And, v)); } @@ -1209,7 +1209,7 @@ namespace spot vec v; v.reserve(s); for (unsigned n = start; n <= end; ++n) - v.push_back(c[n]); + v.emplace_back(c[n]); tail = formula::Concat(v); tail = formula::unop(o, tail); } @@ -1252,9 +1252,9 @@ namespace spot unsigned ss = c.size(); vec v; v.reserve(ss); - v.push_back(formula::Star(sc, 0, max)); + v.emplace_back(formula::Star(sc, 0, max)); for (unsigned n = 1; n < ss; ++n) - v.push_back(c[n]); + v.emplace_back(c[n]); formula tail = formula::Concat(v); tail = // {b[*0..j-i]} or !{b[*0..j-i]} formula::unop(o, tail); @@ -1545,7 +1545,7 @@ namespace spot vec v; for (unsigned n = 0; n < s; ++n) // {r₁}[]->b - v.push_back(formula::binop(bindop, a[n], b)); + v.emplace_back(formula::binop(bindop, a[n], b)); return recurse(formula::multop(op_and, v)); } return orig; @@ -1609,7 +1609,7 @@ namespace spot formula b2 = formula::Or(std::move(*s.res_other)); if (b2 != b) { - s.res_Event->push_back(formula::binop(o, a, b2)); + s.res_Event->emplace_back(formula::binop(o, a, b2)); return recurse (formula::Or(std::move(*s.res_Event))); } @@ -1621,7 +1621,7 @@ namespace spot formula b2 = formula::And(std::move(*s.res_other)); if (b2 != b) { - s.res_EventUniv->push_back(formula::binop(o, + s.res_EventUniv->emplace_back(formula::binop(o, a, b2)); return recurse (formula::And(std::move(*s.res_EventUniv))); @@ -1634,7 +1634,7 @@ namespace spot formula a2 = formula::And(std::move(*s.res_other)); if (a2 != a) { - s.res_EventUniv->push_back(formula::binop(o, + s.res_EventUniv->emplace_back(formula::binop(o, a2, b)); return recurse (formula::And(std::move(*s.res_EventUniv))); @@ -1647,7 +1647,7 @@ namespace spot formula b2 = formula::And(std::move(*s.res_other)); if (b2 != b) { - s.res_Univ->push_back(formula::binop(o, a, b2)); + s.res_Univ->emplace_back(formula::binop(o, a, b2)); return recurse (formula::And(std::move(*s.res_Univ))); } @@ -1939,7 +1939,7 @@ namespace spot vec res; res.reserve(mos); for (auto f: mo) - res.push_back(f); + res.emplace_back(f); op o = mo.kind(); // basics reduction do not concern Boolean formulas, @@ -2093,12 +2093,12 @@ namespace spot vec xgv; xgv.reserve(xgs); for (auto f: xgset) - xgv.push_back(f); + xgv.emplace_back(f); xv.emplace_back(unop_multop(op::G, op::And, xgv)); } for (auto f: xset) xv.emplace_back(f); - res.push_back(unop_multop(op::X, op::And, xv)); + res.emplace_back(unop_multop(op::X, op::And, xv)); } // Gather all operands by type. @@ -2120,7 +2120,7 @@ namespace spot // Xa & Xb & f1...fn = X(a & b & f1...fn) if (!s.res_X->empty() && !opt_.favor_event_univ) { - s.res_X->push_back(allFG); + s.res_X->emplace_back(allFG); allFG = nullptr; s.res_X->insert(s.res_X->begin(), s.res_EventUniv->begin(), @@ -2143,23 +2143,23 @@ namespace spot if (f.is(op::G)) { seen_g = true; - eu.push_back(f[0]); + eu.emplace_back(f[0]); } else { - eu.push_back(f); + eu.emplace_back(f); } } else { - s.res_other->push_back(f); + s.res_other->emplace_back(f); } } if (seen_g) { - eu.push_back(allFG); + eu.emplace_back(allFG); allFG = nullptr; - s.res_other->push_back(unop_multop(op::G, op::And, + s.res_other->emplace_back(unop_multop(op::G, op::And, eu)); } else @@ -2297,10 +2297,10 @@ namespace spot for (auto& f: *s.res_G) if (f.is_eventual()) { - event.push_back(f); + event.emplace_back(f); f = nullptr; // Remove it from res_G. } - s.res_X->push_back(unop_multop(op::G, op::And, + s.res_X->emplace_back(unop_multop(op::G, op::And, std::move(event))); } @@ -2310,9 +2310,9 @@ namespace spot // Xa & Xb & ... = X(a & b & ...) formula allX = unop_multop(op::X, op::And, std::move(*s.res_X)); - s.res_other->push_back(allX); - s.res_other->push_back(allG); - s.res_other->push_back(allFG); + s.res_other->emplace_back(allX); + s.res_other->emplace_back(allG); + s.res_other->emplace_back(allFG); formula r = formula::And(std::move(*s.res_other)); // If we altered the formula in some way, process // it another time. @@ -2337,13 +2337,13 @@ namespace spot // = 0 otherwise if (f.min() > 1 || f.max() < 1) return formula::ff(); - ares.push_back(f[0]); + ares.emplace_back(f[0]); f = nullptr; break; case op::Fusion: // b && {r1:..:rn} = b && r1 && .. && rn for (auto ri: f) - ares.push_back(ri); + ares.emplace_back(ri); f = nullptr; break; case op::Concat: @@ -2368,13 +2368,13 @@ namespace spot } if (nonempty == 1) { - ares.push_back(ri); + ares.emplace_back(ri); } else if (nonempty == 0) { vec sum; for (auto j: f) - sum.push_back(j); + sum.emplace_back(j); ares.emplace_back(formula::OrRat(sum)); } else @@ -2385,11 +2385,11 @@ namespace spot break; } default: - ares.push_back(f); + ares.emplace_back(f); f = nullptr; break; } - ares.push_back(b); + ares.emplace_back(b); auto r = formula::AndRat(std::move(ares)); // If we altered the formula in some way, process // it another time. @@ -2419,13 +2419,13 @@ namespace spot continue; if (i.is(op::Concat)) { - head1.push_back(h); - tail1.push_back(i.all_but(0)); + head1.emplace_back(h); + tail1.emplace_back(i.all_but(0)); } else // op::Fusion { - head2.push_back(h); - tail2.push_back(i.all_but(0)); + head2.emplace_back(h); + tail2.emplace_back(i.all_but(0)); } i = nullptr; } @@ -2433,13 +2433,13 @@ namespace spot { formula h = formula::And(std::move(head1)); formula t = formula::AndRat(std::move(tail1)); - s.res_other->push_back(formula::Concat({h, t})); + s.res_other->emplace_back(formula::Concat({h, t})); } if (!head2.empty()) { formula h = formula::And(std::move(head2)); formula t = formula::AndRat(std::move(tail2)); - s.res_other->push_back(formula::Fusion({h, t})); + s.res_other->emplace_back(formula::Fusion({h, t})); } // {r1;b1}&&{r2;b2} = {r1&&r2};{b1∧b2} @@ -2462,13 +2462,13 @@ namespace spot continue; if (i.is(op::Concat)) { - tail3.push_back(t); - head3.push_back(i.all_but(s)); + tail3.emplace_back(t); + head3.emplace_back(i.all_but(s)); } else // op::Fusion { - tail4.push_back(t); - head4.push_back(i.all_but(s)); + tail4.emplace_back(t); + head4.emplace_back(i.all_but(s)); } i = nullptr; } @@ -2476,13 +2476,13 @@ namespace spot { formula h = formula::AndRat(std::move(head3)); formula t = formula::And(std::move(tail3)); - s.res_other->push_back(formula::Concat({h, t})); + s.res_other->emplace_back(formula::Concat({h, t})); } if (!head4.empty()) { formula h = formula::AndRat(std::move(head4)); formula t = formula::And(std::move(tail4)); - s.res_other->push_back(formula::Fusion({h, t})); + s.res_other->emplace_back(formula::Fusion({h, t})); } auto r = formula::AndRat(std::move(*s.res_other)); @@ -2651,13 +2651,13 @@ namespace spot vec xfv; xfv.reserve(xfs); for (auto f: xfset) - xfv.push_back(f); - xv.push_back(unop_multop(op::F, op::Or, xfv)); + xfv.emplace_back(f); + xv.emplace_back(unop_multop(op::F, op::Or, xfv)); } // Also gather the remaining Xa | X(b|c) as X(b|c). for (auto f: xset) - xv.push_back(f); - res.push_back(unop_multop(op::X, op::Or, xv)); + xv.emplace_back(f); + res.emplace_back(unop_multop(op::X, op::Or, xv)); } // Gather all operand by type. @@ -2679,7 +2679,7 @@ namespace spot // Xa | Xb | f1...fn = X(a | b | f1...fn) if (!s.res_X->empty() && !opt_.favor_event_univ) { - s.res_X->push_back(allGF); + s.res_X->emplace_back(allGF); allGF = nullptr; s.res_X->insert(s.res_X->end(), s.res_EventUniv->begin(), @@ -2713,7 +2713,7 @@ namespace spot // (counting the number of "subtransitions" // or, degeneralizing the automaton amplifies // these differences) - s.res_F->push_back(allGF); + s.res_F->emplace_back(allGF); allGF = nullptr; s.res_F->insert(s.res_F->end(), s.res_EventUniv->begin(), @@ -2721,7 +2721,7 @@ namespace spot } else if (opt_.favor_event_univ) { - s.res_EventUniv->push_back(allGF); + s.res_EventUniv->emplace_back(allGF); allGF = nullptr; bool seen_f = false; if (s.res_EventUniv->size() > 1) @@ -2740,7 +2740,7 @@ namespace spot formula eu = unop_multop(op::F, op::Or, std::move(*s.res_EventUniv)); - s.res_other->push_back(eu); + s.res_other->emplace_back(eu); } } if (!seen_f) @@ -2882,10 +2882,10 @@ namespace spot for (auto& f: *s.res_F) if (f.is_universal()) { - univ.push_back(f); + univ.emplace_back(f); f = nullptr; // Remove it from res_F. } - s.res_X->push_back(unop_multop(op::F, op::Or, + s.res_X->emplace_back(unop_multop(op::F, op::Or, std::move(univ))); } @@ -2895,9 +2895,9 @@ namespace spot // Xa | Xb | ... = X(a | b | ...) formula allX = unop_multop(op::X, op::Or, std::move(*s.res_X)); - s.res_other->push_back(allX); - s.res_other->push_back(allF); - s.res_other->push_back(allGF); + s.res_other->emplace_back(allX); + s.res_other->emplace_back(allF); + s.res_other->emplace_back(allGF); formula r = formula::Or(std::move(*s.res_other)); // If we altered the formula in some way, process // it another time. @@ -2961,16 +2961,16 @@ namespace spot continue; if (i.is(op::Concat)) { - head1.push_back(h); - tail1.push_back(i.all_but(0)); + head1.emplace_back(h); + tail1.emplace_back(i.all_but(0)); } else // op::Fusion { formula t = i.all_but(0); if (t.accepts_eword()) continue; - head2.push_back(h); - tail2.push_back(t); + head2.emplace_back(h); + tail2.emplace_back(t); } i = nullptr; } @@ -2978,13 +2978,13 @@ namespace spot { formula h = formula::And(std::move(head1)); formula t = formula::AndNLM(std::move(tail1)); - s.res_other->push_back(formula::Concat({h, t})); + s.res_other->emplace_back(formula::Concat({h, t})); } if (!head2.empty()) { formula h = formula::And(std::move(head2)); formula t = formula::AndNLM(std::move(tail2)); - s.res_other->push_back(formula::Fusion({h, t})); + s.res_other->emplace_back(formula::Fusion({h, t})); } formula r = formula::AndNLM(std::move(*s.res_other)); diff --git a/spot/twa/acc.cc b/spot/twa/acc.cc index 8643be22e..cede10035 100644 --- a/spot/twa/acc.cc +++ b/spot/twa/acc.cc @@ -519,7 +519,7 @@ namespace spot } } for (auto i: p) - pairs.push_back(i.second); + pairs.emplace_back(i.second); return (!(seen_fin & seen_inf) && (seen_fin | seen_inf) == all_sets()); } @@ -568,7 +568,7 @@ namespace spot codes.reserve(n_accs); for (unsigned i = 0; i < n_accs; ++i) { - codes.push_back(drand() < 0.5 ? inf({i}) : fin({i})); + codes.emplace_back(drand() < 0.5 ? inf({i}) : fin({i})); if (reuse > 0.0 && drand() < reuse) --i; } @@ -664,9 +664,9 @@ namespace spot std::vector r; for (unsigned i = 0; r.size() < umax; ++i) if (used.has(i)) - r.push_back(bdd_ithvar(base++)); + r.emplace_back(bdd_ithvar(base++)); else - r.push_back(bddfalse); + r.emplace_back(bddfalse); return to_bdd_rec(&lhs.back(), &r[0]) == to_bdd_rec(&rhs.back(), &r[0]); } } @@ -740,11 +740,11 @@ namespace spot if (used.has(i)) { sets[base] = i; - r.push_back(bdd_ithvar(base++)); + r.emplace_back(bdd_ithvar(base++)); } else { - r.push_back(bddfalse); + r.emplace_back(bddfalse); } } @@ -812,11 +812,11 @@ namespace spot if (used.has(i)) { sets[base] = i; - r.push_back(bdd_ithvar(base++)); + r.emplace_back(bdd_ithvar(base++)); } else { - r.push_back(bddfalse); + r.emplace_back(bddfalse); } } @@ -886,11 +886,11 @@ namespace spot if (used.has(i)) { sets[base] = i; - r.push_back(bdd_ithvar(base++)); + r.emplace_back(bdd_ithvar(base++)); } else { - r.push_back(bddfalse); + r.emplace_back(bddfalse); } } @@ -950,13 +950,13 @@ namespace spot { sets[base] = i; bdd v = bdd_ithvar(base++); - r.push_back(v); + r.emplace_back(v); if (inf.has(i)) known &= v; } else { - r.push_back(bddfalse); + r.emplace_back(bddfalse); } } @@ -984,12 +984,12 @@ namespace spot bdd h = bdd_high(cube); if (h == bddfalse) // Negative variable { - partial.push_back(s); + partial.emplace_back(s); cube = bdd_low(cube); } else // Positive variable { - partial.push_back(-s - 1); + partial.emplace_back(-s - 1); cube = h; } } @@ -1579,7 +1579,7 @@ namespace spot v.reserve(num); while (num > 0) { - v.push_back(parse_range(input)); + v.emplace_back(parse_range(input)); --num; } c = acc_cond::acc_code::generalized_rabin(v.begin(), v.end()); diff --git a/spot/twa/acc.hh b/spot/twa/acc.hh index 9f3b32841..edcc08ff4 100644 --- a/spot/twa/acc.hh +++ b/spot/twa/acc.hh @@ -647,7 +647,7 @@ namespace spot acc_word w; w.op = acc_op::And; w.size = size(); - push_back(w); + emplace_back(w); return *this; } @@ -738,7 +738,7 @@ namespace spot acc_word w; w.op = acc_op::And; w.size = size(); - push_back(w); + emplace_back(w); return *this; } @@ -782,7 +782,7 @@ namespace spot acc_word w; w.op = acc_op::Or; w.size = size(); - push_back(w); + emplace_back(w); return *this; } diff --git a/spot/twa/formula2bdd.cc b/spot/twa/formula2bdd.cc index d111a5101..dd1106ee9 100644 --- a/spot/twa/formula2bdd.cc +++ b/spot/twa/formula2bdd.cc @@ -55,7 +55,7 @@ namespace spot b = high; } assert(b != bddfalse); - v.push_back(res); + v.emplace_back(res); } return formula::And(v); } diff --git a/spot/twa/taatgba.cc b/spot/twa/taatgba.cc index bb48289df..e831407fe 100644 --- a/spot/twa/taatgba.cc +++ b/spot/twa/taatgba.cc @@ -135,7 +135,7 @@ namespace spot t->condition = bddtrue; t->acceptance_conditions = 0U; t->dst = new taa_tgba::state_set; - succ_.push_back(t); + succ_.emplace_back(t); return; } @@ -150,7 +150,7 @@ namespace spot std::vector pos; pos.reserve(bounds.size()); for (auto i: bounds) - pos.push_back(i.first); + pos.emplace_back(i.first); while (pos[0] != bounds[0].second) { @@ -207,10 +207,10 @@ namespace spot if (t->condition != bddfalse && (i == seen_.end() || j == i->second.end())) { - seen_[b].push_back(t); + seen_[b].emplace_back(t); if (i != seen_.end()) delete b; - succ_.push_back(t); + succ_.emplace_back(t); } else { diff --git a/spot/twa/taatgba.hh b/spot/twa/taatgba.hh index d9e6d978b..9a3c8b647 100644 --- a/spot/twa/taatgba.hh +++ b/spot/twa/taatgba.hh @@ -178,7 +178,7 @@ namespace spot t->dst = dst; t->condition = bddtrue; t->acceptance_conditions = 0U; - src->push_back(t); + src->emplace_back(t); return t; } @@ -186,7 +186,7 @@ namespace spot create_transition(const label& s, const label& d) { std::vector vec; - vec.push_back(d); + vec.emplace_back(d); return create_transition(s, vec); } @@ -266,7 +266,7 @@ namespace spot state_set* ss = new state_set; for (unsigned i = 0; i < names.size(); ++i) ss->insert(add_state(names[i])); - state_set_vec_.push_back(ss); + state_set_vec_.emplace_back(ss); return ss; } diff --git a/spot/twa/twa.hh b/spot/twa/twa.hh index 4ec67956e..435ff447f 100644 --- a/spot/twa/twa.hh +++ b/spot/twa/twa.hh @@ -728,7 +728,7 @@ namespace spot int res = dict_->has_registered_proposition(ap, this); if (res < 0) { - aps_.push_back(ap); + aps_.emplace_back(ap); res = dict_->register_proposition(ap, this); bddaps_ &= bdd_ithvar(res); } @@ -768,7 +768,7 @@ namespace spot for (unsigned n = 0; n < s; ++n) if (m[n].refs.find(this) != m[n].refs.end()) { - aps_.push_back(m[n].f); + aps_.emplace_back(m[n].f); bddaps_ &= bdd_ithvar(n); } } diff --git a/spot/twa/twagraph.cc b/spot/twa/twagraph.cc index f6c1ff9c9..370ab97fb 100644 --- a/spot/twa/twagraph.cc +++ b/spot/twa/twagraph.cc @@ -216,7 +216,7 @@ namespace spot if (tid == 0U) { todo.pop_back(); - order.push_back(src); + order.emplace_back(src); continue; } auto& t = g_.edge_storage(tid); diff --git a/spot/twaalgos/bfssteps.cc b/spot/twaalgos/bfssteps.cc index 78f539456..082c815fd 100644 --- a/spot/twaalgos/bfssteps.cc +++ b/spot/twaalgos/bfssteps.cc @@ -69,7 +69,7 @@ namespace spot // BFS queue. std::deque todo; // Initial state. - todo.push_back(start); + todo.emplace_back(start); while (!todo.empty()) { @@ -97,7 +97,7 @@ namespace spot // for unvisited states. if (father.find(dest) == father.end()) { - todo.push_back(dest); + todo.emplace_back(dest); father[dest] = s; } } diff --git a/spot/twaalgos/canonicalize.cc b/spot/twaalgos/canonicalize.cc index 888b71daf..3870c5449 100644 --- a/spot/twaalgos/canonicalize.cc +++ b/spot/twaalgos/canonicalize.cc @@ -61,7 +61,7 @@ namespace std::sort(signature[s].ingoing.begin(), signature[s].ingoing.end()); std::sort(signature[s].outgoing.begin(), signature[s].outgoing.end()); signature[s].classnum = state2class[s]; - sig2states[signature[s]].push_back(s); + sig2states[signature[s]].emplace_back(s); } return sig2states; diff --git a/spot/twaalgos/compsusp.cc b/spot/twaalgos/compsusp.cc index 91ffa6835..ae9b6a68f 100644 --- a/spot/twaalgos/compsusp.cc +++ b/spot/twaalgos/compsusp.cc @@ -66,17 +66,17 @@ namespace spot { formula c = f[i]; if (c.is_boolean()) - res.push_back(c); + res.emplace_back(c); else if (oblig_ && c.is_syntactic_obligation()) - oblig.push_back(c); + oblig.emplace_back(c); else if (c.is_eventual() && c.is_universal()) - susp.push_back(c); + susp.emplace_back(c); else - res.push_back(recurse(c)); + res.emplace_back(recurse(c)); } if (!oblig.empty()) { - res.push_back(recurse(formula::multop(o, oblig))); + res.emplace_back(recurse(formula::multop(o, oblig))); } if (!susp.empty()) { @@ -85,7 +85,7 @@ namespace spot formula g = recurse(x); if (o == op::And) { - res.push_back(g); + res.emplace_back(g); } else { @@ -191,7 +191,7 @@ namespace spot p.second = ris; unsigned i = res->new_state(); seen[p] = i; - todo.push_back(p); + todo.emplace_back(p); res->set_init_state(i); while (!todo.empty()) @@ -252,7 +252,7 @@ namespace spot { dest = res->new_state(); seen[d] = dest; - todo.push_back(d); + todo.emplace_back(d); } acc_cond::mark_t a = li->acc() | (racc << lsets); diff --git a/spot/twaalgos/copy.cc b/spot/twaalgos/copy.cc index 9461411d7..e2c18f9e0 100644 --- a/spot/twaalgos/copy.cc +++ b/spot/twaalgos/copy.cc @@ -77,9 +77,9 @@ namespace spot if (p.second) { p.first->second = out->new_state(); - todo.push_back(p.first); + todo.emplace_back(p.first); if (names) - names->push_back(aut->format_state(s)); + names->emplace_back(aut->format_state(s)); if (ohstates) { auto q = ohstates->find(aut_g->state_number(s)); diff --git a/spot/twaalgos/cycles.cc b/spot/twaalgos/cycles.cc index e7de7b85b..b4bb7a519 100644 --- a/spot/twaalgos/cycles.cc +++ b/spot/twaalgos/cycles.cc @@ -33,7 +33,7 @@ namespace spot enumerate_cycles::nocycle(unsigned x, unsigned y) { // insert x in B(y) - info_[y].b.push_back(x); + info_[y].b.emplace_back(x); // remove y from A(x) info_[x].del[y] = true; } @@ -42,7 +42,7 @@ namespace spot enumerate_cycles::unmark(unsigned y) { std::vector q; - q.push_back(y); + q.emplace_back(y); while (!q.empty()) { @@ -57,7 +57,7 @@ namespace spot info_[x].del[y] = false; // unmark x recursively if marked if (info_[x].mark) - q.push_back(x); + q.emplace_back(x); } // empty B(y) info_[y].b.clear(); diff --git a/spot/twaalgos/degen.cc b/spot/twaalgos/degen.cc index 73663ed32..c9ae1b9cc 100644 --- a/spot/twaalgos/degen.cc +++ b/spot/twaalgos/degen.cc @@ -220,7 +220,7 @@ namespace spot { // FIXME: revisit this comment once everything compiles again. // - // The order is arbitrary, but it turns out that using push_back + // The order is arbitrary, but it turns out that using emplace_back // instead of push_front often gives better results because // acceptance sets at the beginning if the cycle are more often // used in the automaton. (This surprising fact is probably @@ -228,7 +228,7 @@ namespace spot // during the translation.) unsigned n = a->num_sets(); for (unsigned i = n; i > 0; --i) - order.push_back(i - 1); + order.emplace_back(i - 1); } // Initialize scc_orders @@ -289,7 +289,7 @@ namespace spot } ds2num[s] = res->new_state(); - todo.push_back(s); + todo.emplace_back(s); // If use_lvl_cache is on insert initial state to level cache // Level cache stores first encountered level for each state. @@ -507,7 +507,7 @@ namespace spot { dest = res->new_state(); ds2num[d] = dest; - todo.push_back(d); + todo.emplace_back(d); // Insert new state to cache if (use_lvl_cache) diff --git a/spot/twaalgos/determinize.cc b/spot/twaalgos/determinize.cc index 953bec099..068b59cae 100644 --- a/spot/twaalgos/determinize.cc +++ b/spot/twaalgos/determinize.cc @@ -315,11 +315,11 @@ namespace spot assert(pair.second); ss = ss.compute_succ(aut, ap, scc, implications, is_connected, use_scc, use_simulation); - colors.push_back(ss.color_); + colors.emplace_back(ss.color_); stop = safra2id.find(ss) != safra2id.end(); } // Add color of final transition that loops back - colors.push_back(ss.color_); + colors.emplace_back(ss.color_); unsigned int loop_start = safra2id[ss]; for (auto& min: safra2id) { @@ -352,7 +352,7 @@ namespace spot scc.scc_of(n1.first); if (!is_connected[idx] && bdd_implies(implications.at(n1.first), implications.at(n2.first))) - to_remove.push_back(n1.first); + to_remove.emplace_back(n1.first); } for (auto& n: to_remove) { @@ -515,7 +515,7 @@ namespace spot nodes_.emplace(state_num, std::move(braces)); // First brace has init_state hence one state inside the first // braces. - nb_braces_.push_back(1); + nb_braces_.emplace_back(1); // One brace set is_green_.push_back(true); } @@ -625,7 +625,7 @@ namespace spot all -= one; auto p = bdd2num.emplace(one, num2bdd.size()); if (p.second) - num2bdd.push_back(one); + num2bdd.emplace_back(one); bddnums.emplace_back(p.first->second); } deltas[t.cond] = std::make_pair(prev, bddnums.size()); @@ -652,7 +652,7 @@ namespace spot res->set_init_state(num); seen.insert(std::make_pair(init, num)); std::deque todo; - todo.push_back(init); + todo.emplace_back(init); unsigned sets = 0; using succs_t = safra_state::succs_t; succs_t succs; @@ -678,7 +678,7 @@ namespace spot else { dst_num = res->new_state(); - todo.push_back(s.first); + todo.emplace_back(s.first); seen.insert(std::make_pair(s.first, dst_num)); } if (s.first.color_ != -1U) diff --git a/spot/twaalgos/dtwasat.cc b/spot/twaalgos/dtwasat.cc index c9b01f236..581dd9625 100644 --- a/spot/twaalgos/dtwasat.cc +++ b/spot/twaalgos/dtwasat.cc @@ -444,27 +444,27 @@ namespace spot d.cand_inf_trim_map = split_dnf_acc_by_inf(d.cand_acc); bdd_dict_ptr bd = aut->get_dict(); - d.all_cand_acc.push_back(0U); + d.all_cand_acc.emplace_back(0U); for (unsigned n = 0; n < d.cand_nacc; ++n) { auto c = d.cacc.mark(n); size_t ss = d.all_silly_cand_acc.size(); for (size_t i = 0; i < ss; ++i) - d.all_silly_cand_acc.push_back(d.all_silly_cand_acc[i] | c); + d.all_silly_cand_acc.emplace_back(d.all_silly_cand_acc[i] | c); size_t s = d.all_cand_acc.size(); for (size_t i = 0; i < s; ++i) { acc_cond::mark_t m = d.all_cand_acc[i] | c; if (d.cand_inf_trim(m) == m) - d.all_cand_acc.push_back(m); + d.all_cand_acc.emplace_back(m); else - d.all_silly_cand_acc.push_back(m); + d.all_silly_cand_acc.emplace_back(m); } } - d.all_ref_acc.push_back(0U); + d.all_ref_acc.emplace_back(0U); unsigned ref_nacc = aut->num_sets(); for (unsigned n = 0; n < ref_nacc; ++n) { @@ -475,7 +475,7 @@ namespace spot acc_cond::mark_t m = d.all_ref_acc[i] | c; if (d.ref_inf_trim(m) != m) continue; - d.all_ref_acc.push_back(m); + d.all_ref_acc.emplace_back(m); } } diff --git a/spot/twaalgos/emptiness.cc b/spot/twaalgos/emptiness.cc index 33552a572..5f14eb535 100644 --- a/spot/twaalgos/emptiness.cc +++ b/spot/twaalgos/emptiness.cc @@ -235,12 +235,12 @@ namespace spot for (step s : run.prefix) { s.s = s.s->clone(); - prefix.push_back(s); + prefix.emplace_back(s); } for (step s : run.cycle) { s.s = s.s->clone(); - cycle.push_back(s); + cycle.emplace_back(s); } } @@ -374,7 +374,7 @@ namespace spot seen_acc |= seg->acc; twa_run::step st = { seg->s->clone(), seg->label, seg->acc }; - res->cycle.push_back(st); + res->cycle.emplace_back(st); ++seg; } diff --git a/spot/twaalgos/gv04.cc b/spot/twaalgos/gv04.cc index b2acd72f6..ea3508cef 100644 --- a/spot/twaalgos/gv04.cc +++ b/spot/twaalgos/gv04.cc @@ -180,7 +180,7 @@ namespace spot trace << " s.lowlink = " << top << std::endl << " s.acc = " << ss.acc << std::endl; - stack.push_back(ss); + stack.emplace_back(ss); dftop = top; inc_depth(); } diff --git a/spot/twaalgos/hoa.cc b/spot/twaalgos/hoa.cc index 59188a3b6..f46d33e53 100644 --- a/spot/twaalgos/hoa.cc +++ b/spot/twaalgos/hoa.cc @@ -186,7 +186,7 @@ namespace spot int v = bdd_var(all); all = bdd_high(all); ap.insert(std::make_pair(v, vap.size())); - vap.push_back(v); + vap.emplace_back(v); } if (use_implicit_labels) diff --git a/spot/twaalgos/ltl2taa.cc b/spot/twaalgos/ltl2taa.cc index fcb06373a..2a06fcd02 100644 --- a/spot/twaalgos/ltl2taa.cc +++ b/spot/twaalgos/ltl2taa.cc @@ -64,7 +64,7 @@ namespace spot std::vector empty; res_->create_transition(init_, empty); succ_state ss = { empty, f, empty }; - succ_.push_back(ss); + succ_.emplace_back(ss); return; } case op::eword: @@ -79,7 +79,7 @@ namespace spot taa_tgba::transition* t = res_->create_transition(init_, empty); res_->add_condition(t, f); succ_state ss = { empty, f, empty }; - succ_.push_back(ss); + succ_.emplace_back(ss); return; } case op::X: @@ -89,10 +89,10 @@ namespace spot std::vector a; if (v.succ_.empty()) // Handle X(0) return; - dst.push_back(v.init_); + dst.emplace_back(v.init_); res_->create_transition(init_, dst); succ_state ss = { dst, formula::tt(), a }; - succ_.push_back(ss); + succ_.emplace_back(ss); return; } case op::F: @@ -165,9 +165,9 @@ namespace spot i1->Q.erase (remove(i1->Q.begin(), i1->Q.end(), v1.init_), i1->Q.end()); - i1->Q.push_back(init_); // Add the initial state + i1->Q.emplace_back(init_); // Add the initial state if (strong) - i1->acc.push_back(f[1]); + i1->acc.emplace_back(f[1]); t = res_->create_transition(init_, i1->Q); res_->add_condition(t, i1->condition); if (strong) @@ -175,13 +175,13 @@ namespace spot else for (unsigned i = 0; i < i1->acc.size(); ++i) res_->add_acceptance_condition(t, i1->acc[i]); - succ_.push_back(*i1); + succ_.emplace_back(*i1); } for (i2 = v2.succ_.begin(); i2 != v2.succ_.end(); ++i2) { t = res_->create_transition(init_, i2->Q); res_->add_condition(t, i2->condition); - succ_.push_back(*i2); + succ_.emplace_back(*i2); } return; case op::M: // Strong Release @@ -207,7 +207,7 @@ namespace spot t = res_->create_transition(init_, u); res_->add_condition(t, f); succ_state ss = { u, f, a }; - succ_.push_back(ss); + succ_.emplace_back(ss); } if (refined_) // Refined rule @@ -215,19 +215,19 @@ namespace spot (remove(i2->Q.begin(), i2->Q.end(), v2.init_), i2->Q.end()); - i2->Q.push_back(init_); // Add the initial state + i2->Q.emplace_back(init_); // Add the initial state t = res_->create_transition(init_, i2->Q); res_->add_condition(t, i2->condition); if (strong) { - i2->acc.push_back(f[0]); + i2->acc.emplace_back(f[0]); res_->add_acceptance_condition(t, f[0]); } else if (refined_) for (unsigned i = 0; i < i2->acc.size(); ++i) res_->add_acceptance_condition(t, i2->acc[i]); - succ_.push_back(*i2); + succ_.emplace_back(*i2); } return; default: @@ -243,7 +243,7 @@ namespace spot std::vector vs; for (unsigned n = 0, s = f.size(); n < s; ++n) { - vs.push_back(recurse(f[n])); + vs.emplace_back(recurse(f[n])); if (vs[n].succ_.empty()) // Handle 0 ok = false; } @@ -268,7 +268,7 @@ namespace spot if (!binary_search(p[n].Q.begin(), p[n].Q.end(), vs[m].init_)) break; - v.push_back(vs[m].init_); + v.emplace_back(vs[m].init_); } if (v.size() == f.size()) @@ -277,19 +277,19 @@ namespace spot sort(v.begin(), v.end()); for (unsigned m = 0; m < p[n].Q.size(); ++m) if (!binary_search(v.begin(), v.end(), p[n].Q[m])) - Q.push_back(p[n].Q[m]); - Q.push_back(init_); + Q.emplace_back(p[n].Q[m]); + Q.emplace_back(init_); t = res_->create_transition(init_, Q); res_->add_condition(t, p[n].condition); for (unsigned i = 0; i < p[n].acc.size(); ++i) res_->add_acceptance_condition(t, p[n].acc[i]); - succ_.push_back(p[n]); + succ_.emplace_back(p[n]); continue; } } t = res_->create_transition(init_, p[n].Q); res_->add_condition(t, p[n].condition); - succ_.push_back(p[n]); + succ_.emplace_back(p[n]); } return; } @@ -299,7 +299,7 @@ namespace spot { t = res_->create_transition(init_, i.Q); res_->add_condition(t, i.condition); - succ_.push_back(i); + succ_.emplace_back(i); } return; default: @@ -359,11 +359,11 @@ namespace spot for (unsigned i = 0; i < ss.acc.size(); ++i) { formula g = ss.acc[i]; - a.push_back(g); + a.emplace_back(g); } } succ_state ss = { u, f, a }; - product.push_back(ss); + product.emplace_back(ss); for (int i = vs.size() - 1; i >= 0; --i) { diff --git a/spot/twaalgos/ltl2tgba_fm.cc b/spot/twaalgos/ltl2tgba_fm.cc index db276cf98..5d8c480d3 100644 --- a/spot/twaalgos/ltl2tgba_fm.cc +++ b/spot/twaalgos/ltl2tgba_fm.cc @@ -247,7 +247,7 @@ namespace spot a = bdd_low(a); if (h != bddfalse) { - t.push_back(bm[v]); + t.emplace_back(bm[v]); if (a == bddfalse) a = h; } @@ -434,7 +434,7 @@ namespace spot b = high; } assert(b != bddfalse); - v.push_back(res); + v.emplace_back(res); } return formula::multop(o, std::move(v)); } @@ -455,7 +455,7 @@ namespace spot minato_isop isop(f); bdd cube; while ((cube = isop.next()) != bddfalse) - v.push_back(conj_bdd_to_formula(cube)); + v.emplace_back(conj_bdd_to_formula(cube)); return formula::Or(std::move(v)); } @@ -469,7 +469,7 @@ namespace spot minato_isop isop(f); bdd cube; while ((cube = isop.next()) != bddfalse) - v.push_back(conj_bdd_to_sere(cube)); + v.emplace_back(conj_bdd_to_sere(cube)); return formula::OrRat(std::move(v)); } @@ -742,9 +742,9 @@ namespace spot for (auto g: f) if (g.accepts_eword()) - final.push_back(g); + final.emplace_back(g); else - non_final.push_back(g); + non_final.emplace_back(g); if (non_final.empty()) // (a* & b*);c = (a*|b*);c @@ -780,9 +780,9 @@ namespace spot formula g = f[m]; if (n != m) g = formula::Concat({g, star}); - conj.push_back(g); + conj.emplace_back(g); } - disj.push_back(formula::AndRat(std::move(conj))); + disj.emplace_back(formula::AndRat(std::move(conj))); } return recurse_and_concat(formula::OrRat(std::move(disj))); } @@ -813,9 +813,9 @@ namespace spot unsigned s = f.size(); v.reserve(s); for (unsigned n = 1; n < s; ++n) - v.push_back(f[n]); + v.emplace_back(f[n]); if (to_concat_) - v.push_back(to_concat_); + v.emplace_back(to_concat_); return recurse(f[0], formula::Concat(std::move(v))); } case op::Fusion: @@ -2092,7 +2092,7 @@ namespace spot bdd conds = bdd_existcomp(label, d.var_set); bdd promises = bdd_existcomp(label, d.a_set); - dests.push_back(transition(dest, conds, promises)); + dests.emplace_back(transition(dest, conds, promises)); } } diff --git a/spot/twaalgos/magic.cc b/spot/twaalgos/magic.cc index f92b88a88..705329818 100644 --- a/spot/twaalgos/magic.cc +++ b/spot/twaalgos/magic.cc @@ -346,21 +346,21 @@ namespace spot for (; i != end; ++i, ++j) { twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); } l = &run->cycle; j = ms_->st_red.rbegin(); twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); i = j; ++j; end = ms_->st_red.rend(); --end; for (; i != end; ++i, ++j) { twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); } return run; diff --git a/spot/twaalgos/mask.hh b/spot/twaalgos/mask.hh index b5a1aa1b4..7218e2150 100644 --- a/spot/twaalgos/mask.hh +++ b/spot/twaalgos/mask.hh @@ -54,7 +54,7 @@ namespace spot { tmp = cpy->new_state(); seen[old_state] = tmp; - todo.push_back(old_state); + todo.emplace_back(old_state); } return tmp; }; diff --git a/spot/twaalgos/minimize.cc b/spot/twaalgos/minimize.cc index 7a80fbf56..b6403bf4b 100644 --- a/spot/twaalgos/minimize.cc +++ b/spot/twaalgos/minimize.cc @@ -293,9 +293,9 @@ namespace spot used_var[set_num] = s; free_var.erase(set_num); if (s > 1) - cur_run.push_back(final); + cur_run.emplace_back(final); else - done.push_back(final); + done.emplace_back(final); for (hash_set::const_iterator i = final->begin(); i != final->end(); ++i) state_set_map[*i] = set_num; @@ -314,9 +314,9 @@ namespace spot used_var[num] = s; free_var.erase(num); if (s > 1) - cur_run.push_back(non_final); + cur_run.emplace_back(non_final); else - done.push_back(non_final); + done.emplace_back(non_final); for (hash_set::const_iterator i = non_final->begin(); i != non_final->end(); ++i) state_set_map[*i] = num; @@ -388,7 +388,7 @@ namespace spot // The set was not split. trace << "set " << format_hash_set(bsi->second, det_a) << " was not split" << std::endl; - next_run.push_back(bsi->second); + next_run.emplace_back(bsi->second); } else { @@ -421,13 +421,13 @@ namespace spot { trace << "set " << format_hash_set(set, det_a) << " is minimal" << std::endl; - done.push_back(set); + done.emplace_back(set); } else { trace << "set " << format_hash_set(set, det_a) << " should be processed further" << std::endl; - next_run.push_back(set); + next_run.emplace_back(set); } } } diff --git a/spot/twaalgos/powerset.cc b/spot/twaalgos/powerset.cc index f1e6608c9..7e064a3d4 100644 --- a/spot/twaalgos/powerset.cc +++ b/spot/twaalgos/powerset.cc @@ -121,7 +121,7 @@ namespace spot bdd one = bdd_satoneset(all, allap, bddfalse); all -= one; bdd2num.emplace(one, num2bdd.size()); - num2bdd.push_back(one); + num2bdd.emplace_back(one); } size_t nc = num2bdd.size(); // number of conditions @@ -167,7 +167,7 @@ namespace spot seen[bvi] = num; assert(pm.map_.size() == num); pm.map_.emplace_back(std::move(ps)); - toclean.push_back(bvi); + toclean.emplace_back(bvi); } // outgoing map @@ -201,7 +201,7 @@ namespace spot dst_num = res->new_state(); auto dst2 = dst->clone(); seen[dst2] = dst_num; - toclean.push_back(dst2); + toclean.emplace_back(dst2); auto ps = bv_to_ps(dst); assert(pm.map_.size() == dst_num); pm.map_.emplace_back(std::move(ps)); @@ -340,7 +340,7 @@ namespace spot while (i != dfs_.end()); if (is_acc) { - accept_.push_back(ts); + accept_.emplace_back(ts); all_.insert(ts.begin(), ts.end()); } else diff --git a/spot/twaalgos/product.cc b/spot/twaalgos/product.cc index 0ba1f05ca..f7ddd9496 100644 --- a/spot/twaalgos/product.cc +++ b/spot/twaalgos/product.cc @@ -76,7 +76,7 @@ namespace spot p.first->second = res->new_state(); todo.emplace_back(x, p.first->second); assert(p.first->second == v->size()); - v->push_back(x); + v->emplace_back(x); } return p.first->second; }; diff --git a/spot/twaalgos/randomgraph.cc b/spot/twaalgos/randomgraph.cc index 4439d1764..ae16716b0 100644 --- a/spot/twaalgos/randomgraph.cc +++ b/spot/twaalgos/randomgraph.cc @@ -63,7 +63,7 @@ namespace spot } else { - labels.push_back(current); + labels.emplace_back(current); return 1; } } @@ -189,7 +189,7 @@ namespace spot } else for (unsigned i = 0; i < nsucc; ++i) - labels.push_back(random_labels(props, props_n, t)); + labels.emplace_back(random_labels(props, props_n, t)); int possibilities = n; unsigned dst; diff --git a/spot/twaalgos/reachiter.cc b/spot/twaalgos/reachiter.cc index 0096e9de3..33ece2d65 100644 --- a/spot/twaalgos/reachiter.cc +++ b/spot/twaalgos/reachiter.cc @@ -130,7 +130,7 @@ namespace spot void twa_reachable_iterator_breadth_first::add_state(const state* s) { - todo.push_back(s); + todo.emplace_back(s); } const state* @@ -170,7 +170,7 @@ namespace spot twa_succ_iterator* si = aut_->succ_iter(s); process_state(s, sn, si); stack_item item = { s, sn, si }; - todo.push_back(item); + todo.emplace_back(item); si->first(); } diff --git a/spot/twaalgos/relabel.cc b/spot/twaalgos/relabel.cc index 906e30795..c1cc07cd5 100644 --- a/spot/twaalgos/relabel.cc +++ b/spot/twaalgos/relabel.cc @@ -34,7 +34,7 @@ namespace spot int oldv = aut->register_ap(p.first); int newv = aut->register_ap(p.second); bdd_setpair(pairs, oldv, newv); - vars.push_back(oldv); + vars.emplace_back(oldv); newvars.insert(newv); } for (auto& t: aut->edges()) diff --git a/spot/twaalgos/remfin.cc b/spot/twaalgos/remfin.cc index 9eeac1b13..8492c6d26 100644 --- a/spot/twaalgos/remfin.cc +++ b/spot/twaalgos/remfin.cc @@ -537,7 +537,7 @@ namespace spot { // The empty Fin should always come first assert(p.first != 0U || rem.empty()); - rem.push_back(p.first); + rem.emplace_back(p.first); allfin |= p.first; acc_cond::mark_t inf = 0U; if (!p.second.empty()) @@ -568,10 +568,10 @@ namespace spot { has_true_term = true; } - code.push_back(std::move(p.second)); - keep.push_back(inf); + code.emplace_back(std::move(p.second)); + keep.emplace_back(inf); allinf |= inf; - add.push_back(0U); + add.emplace_back(0U); } } assert(add.size() > 0); diff --git a/spot/twaalgos/sccfilter.cc b/spot/twaalgos/sccfilter.cc index 5eabfbc98..0474bd9de 100644 --- a/spot/twaalgos/sccfilter.cc +++ b/spot/twaalgos/sccfilter.cc @@ -297,9 +297,9 @@ namespace spot inout.reserve(in_n); for (unsigned i = 0; i < in_n; ++i) if (filter.state(i)) - inout.push_back(out_n++); + inout.emplace_back(out_n++); else - inout.push_back(-1U); + inout.emplace_back(-1U); filter.fix_acceptance(filtered); filtered->new_states(out_n); diff --git a/spot/twaalgos/se05.cc b/spot/twaalgos/se05.cc index 8ed040ddd..ee77ff4f1 100644 --- a/spot/twaalgos/se05.cc +++ b/spot/twaalgos/se05.cc @@ -356,7 +356,7 @@ namespace spot if (l == &run->prefix && i->s->compare(target) == 0) l = &run->cycle; twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); } if (l == &run->prefix && i->s->compare(target) == 0) @@ -365,14 +365,14 @@ namespace spot j = ms_->st_red.rbegin(); twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); i = j; ++j; end = ms_->st_red.rend(); --end; for (; i != end; ++i, ++j) { twa_run::step s = { i->s->clone(), j->label, j->acc }; - l->push_back(s); + l->emplace_back(s); } return run; diff --git a/spot/twaalgos/simulation.cc b/spot/twaalgos/simulation.cc index 97ddcf3a2..0392a0a6c 100644 --- a/spot/twaalgos/simulation.cc +++ b/spot/twaalgos/simulation.cc @@ -146,7 +146,7 @@ namespace spot std::vector res; while (b != bddtrue) { - res.push_back(bdd_var(b) - acc_vars); + res.emplace_back(bdd_var(b) - acc_vars); b = bdd_high(b); } return acc_cond::mark_t(res.begin(), res.end()); @@ -238,7 +238,7 @@ namespace spot bdd_initial = bdd_ithvar(set_num++); bdd init = bdd_ithvar(set_num++); - used_var_.push_back(init); + used_var_.emplace_back(init); // Initialize all classes to init. previous_class_.resize(size_a_); @@ -348,7 +348,7 @@ namespace spot void update_sig() { for (unsigned s = 0; s < size_a_; ++s) - bdd_lstate_[compute_sig(s)].push_back(s); + bdd_lstate_[compute_sig(s)].emplace_back(s); } @@ -363,7 +363,7 @@ namespace spot for (int i = 0; i < nb_new_color; ++i) { assert(!free_var_.empty()); - used_var_.push_back(bdd_ithvar(free_var_.front())); + used_var_.emplace_back(bdd_ithvar(free_var_.front())); free_var_.pop(); } diff --git a/spot/twaalgos/stutter.cc b/spot/twaalgos/stutter.cc index 7d37ec983..33c9e185c 100644 --- a/spot/twaalgos/stutter.cc +++ b/spot/twaalgos/stutter.cc @@ -300,7 +300,7 @@ namespace spot stutter_state s(s0, bddfalse); ss2num[s] = 0; res->new_state(); - todo.push_back(s); + todo.emplace_back(s); while (!todo.empty()) { @@ -325,7 +325,7 @@ namespace spot if (r.second) { - todo.push_back(d); + todo.emplace_back(d); unsigned u = res->new_state(); assert(u == dest); (void)u; @@ -439,8 +439,8 @@ namespace spot for (auto it = trans.begin(); it != trans.end(); ++it) { - todo.push_back(it.trans()); - dst2trans[it->dst].push_back(it.trans()); + todo.emplace_back(it.trans()); + dst2trans[it->dst].emplace_back(it.trans()); } while (!todo.empty()) @@ -465,7 +465,7 @@ namespace spot ts.cond |= cond; if (std::find(todo.begin(), todo.end(), t) == todo.end()) - todo.push_back(t); + todo.emplace_back(t); } need_new_trans = false; break; @@ -478,7 +478,7 @@ namespace spot ts.acc = acc; if (std::find(todo.begin(), todo.end(), t) == todo.end()) - todo.push_back(t); + todo.emplace_back(t); } need_new_trans = false; break; @@ -490,8 +490,8 @@ namespace spot // invalidated by new_edge(). auto dst = t2.dst; auto i = a->new_edge(state, dst, cond, acc); - dst2trans[dst].push_back(i); - todo.push_back(i); + dst2trans[dst].emplace_back(i); + todo.emplace_back(i); } } } diff --git a/spot/twaalgos/tau03opt.cc b/spot/twaalgos/tau03opt.cc index 7eb788100..fd3d2acc6 100644 --- a/spot/twaalgos/tau03opt.cc +++ b/spot/twaalgos/tau03opt.cc @@ -161,7 +161,7 @@ namespace spot std::vector res; unsigned max = a_->num_sets(); for (unsigned n = 0; n < max && acc.has(n); ++n) - res.push_back(n); + res.emplace_back(n); return acc_cond::mark_t(res.begin(), res.end()); } diff --git a/spot/twaalgos/totgba.cc b/spot/twaalgos/totgba.cc index c4c2bc5d0..eb85a291a 100644 --- a/spot/twaalgos/totgba.cc +++ b/spot/twaalgos/totgba.cc @@ -84,7 +84,7 @@ namespace spot m |= pos[-1].mark; pos -= 2; } - res.push_back(m); + res.emplace_back(m); } return res; } @@ -162,7 +162,7 @@ namespace spot st2gba_state s(in->get_init_state_number()); bs2num[s] = out->new_state(); - todo.push_back(s); + todo.emplace_back(s); bool sbacc = in->prop_state_acc().is_true(); @@ -234,7 +234,7 @@ namespace spot else // No, this is a new state { dest = dres.first->second = out->new_state(); - todo.push_back(d); + todo.emplace_back(d); } out->new_edge(src, dest, t.cond, acc); @@ -264,7 +264,7 @@ namespace spot else // No, this is a new state { dest = dres.first->second = out->new_state(); - todo.push_back(d); + todo.emplace_back(d); } out->new_edge(src, dest, t.cond); } diff --git a/spot/twaalgos/word.cc b/spot/twaalgos/word.cc index 111dd5015..7071627ad 100644 --- a/spot/twaalgos/word.cc +++ b/spot/twaalgos/word.cc @@ -30,9 +30,9 @@ namespace spot : dict_(run->aut->get_dict()) { for (auto& i: run->prefix) - prefix.push_back(i.label); + prefix.emplace_back(i.label); for (auto& i: run->cycle) - cycle.push_back(i.label); + cycle.emplace_back(i.label); dict_->register_all_variables_of(run->aut, this); } @@ -58,7 +58,7 @@ namespace spot if (all != bddfalse) { cycle.clear(); - cycle.push_back(all); + cycle.emplace_back(all); } } // If the last formula of the prefix is compatible with the @@ -175,7 +175,7 @@ namespace spot if (!pf.errors.empty()) word_parse_error(word, i, pf); atomic_prop_collect(pf.f, &aps); - seq.push_back(tls.as_bdd(pf.f)); + seq.emplace_back(tls.as_bdd(pf.f)); if (word[ind] == '}') return true; // Skip blanks after semi-colon diff --git a/tests/core/bitvect.cc b/tests/core/bitvect.cc index 997a4d559..0b406b748 100644 --- a/tests/core/bitvect.cc +++ b/tests/core/bitvect.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et +// Copyright (C) 2013, 2014, 2015, 2016 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -68,7 +68,7 @@ int main() << ' ' << v->is_subset_of(*w) << '\n'; for (size_t i = 0; i < 30; ++i) - w->push_back((i & 3) == 0); + w->emplace_back((i & 3) == 0); ECHO(w); *x &= *w; ECHO(x); @@ -77,7 +77,7 @@ int main() ruler(); - w->push_back(0x09, 4); + w->emplace_back(0x09, 4); ECHO(w); spot::bitvect* y = w->extract_range(0, 71); ECHO(y); @@ -116,7 +116,7 @@ int main() ruler(); for (size_t i = 0; i < 12; ++i) - a->at(4).push_back((i & 2) == 0); + a->at(4).emplace_back((i & 2) == 0); a->at(6) = a->at(4); a->at(8) = a->at(7); a->at(6) ^= a->at(8);