diff --git a/include/cantera/kinetics/StoichManager.h b/include/cantera/kinetics/StoichManager.h index 9a9fc805e..b70284db1 100644 --- a/include/cantera/kinetics/StoichManager.h +++ b/include/cantera/kinetics/StoichManager.h @@ -608,7 +608,7 @@ public: } } if (frac || k.size() > 3) { - m_cn_list.push_back(C_AnyN(rxn, k, order, stoich)); + m_cn_list.emplace_back(rxn, k, order, stoich); } else { // Try to express the reaction with unity stoichiometric // coefficients (by repeating species when necessary) so that the @@ -623,16 +623,16 @@ public: switch (kRep.size()) { case 1: - m_c1_list.push_back(C1(rxn, kRep[0])); + m_c1_list.emplace_back(rxn, kRep[0]); break; case 2: - m_c2_list.push_back(C2(rxn, kRep[0], kRep[1])); + m_c2_list.emplace_back(rxn, kRep[0], kRep[1]); break; case 3: - m_c3_list.push_back(C3(rxn, kRep[0], kRep[1], kRep[2])); + m_c3_list.emplace_back(rxn, kRep[0], kRep[1], kRep[2]); break; default: - m_cn_list.push_back(C_AnyN(rxn, k, order, stoich)); + m_cn_list.emplace_back(rxn, k, order, stoich); } } } diff --git a/include/cantera/kinetics/ThirdBodyCalc.h b/include/cantera/kinetics/ThirdBodyCalc.h index b9874253e..7469d5afb 100644 --- a/include/cantera/kinetics/ThirdBodyCalc.h +++ b/include/cantera/kinetics/ThirdBodyCalc.h @@ -21,8 +21,8 @@ public: m_reaction_index.push_back(rxnNumber); m_default.push_back(dflt); - m_species.push_back(std::vector()); - m_eff.push_back(vector_fp()); + m_species.emplace_back(); + m_eff.emplace_back(); for (const auto& eff : enhanced) { assert(eff.first != npos); m_species.back().push_back(eff.first); diff --git a/src/base/application.cpp b/src/base/application.cpp index e7f9f8fc8..05f46ec93 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -133,7 +133,7 @@ Application::Messages* Application::ThreadMessages::operator ->() return iter->second.get(); } pMessages_t pMsgs(new Messages()); - m_threadMsgMap.insert(std::pair< cthreadId_t, pMessages_t >(curId, pMsgs)); + m_threadMsgMap.emplace(curId, pMsgs); return pMsgs.get(); } diff --git a/src/base/xml.cpp b/src/base/xml.cpp index fab9af743..14eda837a 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -396,7 +396,7 @@ void XML_Node::addComment(const std::string& comment) XML_Node& XML_Node::mergeAsChild(XML_Node& node) { m_children.push_back(&node); - m_childindex.insert(pair(node.name(), m_children.back())); + m_childindex.emplace(node.name(), m_children.back()); node.setRoot(root()); node.setParent(this); return *m_children.back(); diff --git a/src/kinetics/InterfaceKinetics.cpp b/src/kinetics/InterfaceKinetics.cpp index f88a7381a..5e6f7358b 100644 --- a/src/kinetics/InterfaceKinetics.cpp +++ b/src/kinetics/InterfaceKinetics.cpp @@ -739,8 +739,8 @@ bool InterfaceKinetics::addReaction(shared_ptr r_base) m_nirrev++; } - m_rxnPhaseIsReactant.push_back(std::vector(nPhases(), false)); - m_rxnPhaseIsProduct.push_back(std::vector(nPhases(), false)); + m_rxnPhaseIsReactant.emplace_back(nPhases(), false); + m_rxnPhaseIsProduct.emplace_back(nPhases(), false); for (const auto& sp : r.reactants) { size_t k = kineticsSpeciesIndex(sp.first); @@ -835,7 +835,7 @@ SurfaceArrhenius InterfaceKinetics::buildSurfaceArrhenius( } } if (i != npos) { - m_sticking_orders.push_back(make_pair(i, surface_order)); + m_sticking_orders.emplace_back(i, surface_order); } } diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 2aacf2291..322a8be37 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -159,7 +159,7 @@ std::pair Kinetics::checkDuplicates(bool throw_err) const // Get data about this reaction unsigned long int key = 0; Reaction& R = *m_reactions[i]; - net_stoich.push_back(std::map()); + net_stoich.emplace_back(); std::map& net = net_stoich.back(); for (const auto& sp : R.reactants) { int k = static_cast(kineticsSpeciesIndex(sp.first)); diff --git a/src/kinetics/Reaction.cpp b/src/kinetics/Reaction.cpp index 4f28506f7..9b6e7daf1 100644 --- a/src/kinetics/Reaction.cpp +++ b/src/kinetics/Reaction.cpp @@ -432,8 +432,7 @@ void setupPlogReaction(PlogReaction& R, const XML_Node& rxn_node) std::multimap rates; for (size_t m = 0; m < rc.nChildren(); m++) { const XML_Node& node = rc.child(m); - rates.insert(std::make_pair(getFloat(node, "P", "toSI"), - readArrhenius(node))); + rates.emplace(getFloat(node, "P", "toSI"), readArrhenius(node)); } R.rate = Plog(rates); setupReaction(R, rxn_node); diff --git a/src/kinetics/RxnRates.cpp b/src/kinetics/RxnRates.cpp index c4ad7416e..7c1e48e46 100644 --- a/src/kinetics/RxnRates.cpp +++ b/src/kinetics/RxnRates.cpp @@ -89,8 +89,8 @@ Plog::Plog(const std::multimap& rates) } // Duplicate the first and last groups to handle P < P_0 and P > P_N - pressures_.insert(std::make_pair(-1000.0, pressures_.begin()->second)); - pressures_.insert(std::make_pair(1000.0, pressures_.rbegin()->second)); + pressures_.emplace(-1000.0, pressures_.begin()->second); + pressures_.emplace(1000.0, pressures_.rbegin()->second); } void Plog::validate(const std::string& equation) @@ -122,7 +122,7 @@ std::vector > Plog::rates() const for (size_t i = iter->second.first; i < iter->second.second; i++) { - R.push_back(std::make_pair(std::exp(iter->first), rates_[i])); + R.emplace_back(std::exp(iter->first), rates_[i]); } } return R; diff --git a/src/numerics/CVodesIntegrator.cpp b/src/numerics/CVodesIntegrator.cpp index 6f0f2f380..ba79eed0c 100644 --- a/src/numerics/CVodesIntegrator.cpp +++ b/src/numerics/CVodesIntegrator.cpp @@ -457,10 +457,10 @@ string CVodesIntegrator::getErrorInfo(int N) CVodeGetErrWeights(m_cvode_mem, errw); CVodeGetEstLocalErrors(m_cvode_mem, errs); - vector, size_t> > weightedErrors; + vector > weightedErrors; for (size_t i=0; i(weightedErrors[i]) << ": " + << get<1>(weightedErrors[i]) << endl; } return s.str(); } diff --git a/src/thermo/GeneralSpeciesThermo.cpp b/src/thermo/GeneralSpeciesThermo.cpp index fc9b6dfc8..fc535ff88 100644 --- a/src/thermo/GeneralSpeciesThermo.cpp +++ b/src/thermo/GeneralSpeciesThermo.cpp @@ -36,7 +36,7 @@ GeneralSpeciesThermo::GeneralSpeciesThermo(const GeneralSpeciesThermo& b) : size_t i = sp.second[k].first; shared_ptr spec( sp.second[k].second->duplMyselfAsSpeciesThermoInterpType()); - m_sp[sp.first].push_back(std::make_pair(i, spec)); + m_sp[sp.first].emplace_back(i, spec); } } } @@ -56,7 +56,7 @@ GeneralSpeciesThermo::operator=(const GeneralSpeciesThermo& b) size_t i = sp.second[k].first; shared_ptr spec( sp.second[k].second->duplMyselfAsSpeciesThermoInterpType()); - m_sp[sp.first].push_back(std::make_pair(i, spec)); + m_sp[sp.first].emplace_back(i, spec); } } @@ -85,7 +85,7 @@ void GeneralSpeciesThermo::install_STIT(size_t index, "Index position isn't null, duplication of assignment: {}", index); int type = stit_ptr->reportType(); m_speciesLoc[index] = std::make_pair(type, m_sp[type].size()); - m_sp[type].push_back(std::make_pair(index, stit_ptr)); + m_sp[type].emplace_back(index, stit_ptr); if (m_sp[type].size() == 1) { m_tpoly[type].resize(stit_ptr->temperaturePolySize()); } diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index a3ae16f66..135e30704 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -447,7 +447,7 @@ void TransportFactory::getLiquidSpeciesTransportData(const std::vector(name,data)); + datatable.emplace(name,data); } } catch (CanteraError& err) { err.save(); diff --git a/src/zeroD/Reactor.cpp b/src/zeroD/Reactor.cpp index 0247478ab..711aa6709 100644 --- a/src/zeroD/Reactor.cpp +++ b/src/zeroD/Reactor.cpp @@ -325,10 +325,10 @@ void Reactor::addSensitivityReaction(size_t rxn) std::vector > Reactor::getSensitivityOrder() const { std::vector > order; - order.push_back(std::make_pair(const_cast(this), 0)); + order.emplace_back(const_cast(this), 0); for (size_t n = 0; n < m_wall.size(); n++) { if (m_nsens_wall[n]) { - order.push_back(std::make_pair(m_wall[n], m_lr[n])); + order.emplace_back(m_wall[n], m_lr[n]); } } return order;